[Solved] Checkbox mutual exclusivity


Many thanks in advance to anybody who may be able to assist.

I’m trying to create mutual exclusivity between two checkboxes (i.e. when one of these check boxes is checked, the other is automatically unchecked). I have two different applications:

  1. Scenario 1: The two checkboxes that are contained in the same longer list of checkboxes (seven checkboxes all up, but only two within this list are to be mutually exclusive).
  2. Scenario 2: The two checkboxes are contained in separate lists of checkboxes (but on the same survey question page).

Javascript is the best tool, but I’m afraid I’m not fluent and am having trouble adapting some of the SG sample scripts. I can get close to making it work outside of SG, but within the SG platform I can only get as far as adding a JS action to the top of the page.

any assistance greatly appreciated. 

KiwiJoker answered

    Best answer


    Hi Nate-

    many thanks for your help. This is spot on and serves both scenarios properly. There is one little issue that I will mention in GitHub as well as here. The issue is true for both scenarios I described above.

    In combination with a “none of the above” checkbox in SurveyGizmo, if a user checks any of the exclusive checkbox group(s) and then checks the “none of the above” checkbox followed by unchecking the “none of the above” checkbox (in an effort to re-answer the question), the script won’t restore to the original unanswered state – instead if makes all checkboxes in exclusive groups unanswerable. That’s a confusing (and low probability) use-case I know!

    To replicate try the following:

    1. Load a question (or questions) with checkboxes that use the javascript, as well as have a “none-of-the-above” option 
    2. Check one of the checkboxes in the exclusive groups as defined by the javascript
    3. Then check the “none-of-the-above” option
    4. Now uncheck the “none-of-the-above” option
    5. This should result in the disabling of all grouped exclusive checkboxes that were previously checked.

    I tried adding the exclusive group classes (<i class="ns-exclusive-GROUP"></i>) to the “none-of-the-above” option. This helped for scenario 1 where the mutually exclusive group is within the same list of checkboxes, but it didn’t help scenario 2 where I need to ensure contextual availability of another checkbox in a different list.

    The only reason for ensuring this robustness is for survey respondents who change their mind quite a bit when answering the two questions for which the script you wrote will be used.

    many thanks.


    Joe Colgan372605 answered

      Hi – I’ve just clicked the GitHub link and the script is no longer there. Is it possible to have a copy of the script?

      KiwiJoker answered

        Hey Nate. Thanks. Will check this out and report back.

        Joe Colgan372605 answered
          Nate 20 Rep.

          Hi Joe,

          Try this out for size:


          Place the script in a Javascript Action at the bottom of your survey, and then add (HTML) tags to your checkbox answer options as described in the README. If you find any problems, feel free to open an issue in GitHub 🙂

          Nate answered


            Question stats

            • Active
            • Views12551 times
            • Answers4 answers
            • Followers0 followers