Select to view content in your preferred language

How to make one checkbox an exclusive choice Survey123

2216
8
Jump to solution
02-08-2023 06:22 AM
mattCSimon1
Emerging Contributor

I am new to survey123 but not new to coding data entry forms and I'm trying to replicate a function that I use often. I want to make some of my checkboxes exclusive choices (Qualtrics terminology). In other words, when a user selects this checkbox, it means that none of the other checkboxes can be selected. I'm sure I'm missing an easy solution, but I'm stumped and couldn't find any solutions in the forums or documentation. Image below and excel attached.

 

mattCSimon1_0-1675865980620.png

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Take a look at Choice Filters. Trying to filter a question based on its own choices gets pretty wonky, and is not likely to work right. I can get a question to hide the other options when "none of the above" is checked, but the question "locks" after the initial selection, and I cannot check or uncheck anything. The GIF below doesn't show my clicks, but I'm trying my best to change the selection:

Survey123Connect_MHVLGjcmOa.gif

Best practice would be to have your choice filter operate on a separate question. You could break question 24 into two parts, perhaps. Have a select_multiple with all the problems except for the exclusive choices. Then put a select_one with "none of the above" and "prefer not to answer" immediately after it.

In my test form, my second question is called choices_exc, with the values being "none" and "no_answer". Then, in the choice_filter column of the main question, I have the expression not(selected(${choices_exc}, 'none') or selected(${choices_exc}, 'no_answer')).

There's a gap between the choices which is kind of annoying, but sometimes function comes before form.

Survey123Connect_bOLgExq3av.gif

In order to still capture the data, you could add some calculation logic to the main question to pipe in the selection from choices_exc if one is selected.

- Josh Carlson
Kendall County GIS

View solution in original post

8 Replies
TraceyDixon1
Emerging Contributor

Make it a single choice option in the design of the survey, not multichoice?

0 Kudos
TraceyDixon1
Emerging Contributor

Sorry, somewhere it should be 'select_one' not 'select_multiple' - didn't see the xml, apologies....

0 Kudos
mattCSimon1
Emerging Contributor

no worries - yeah it needs to remain as a select multiple so that a user can check more than one option...I just can't figure out how to make the calculation work to 'uncheck' the other boxes

0 Kudos
TraceyDixon1
Emerging Contributor

Not sure what you mean by unchecking boxes... but it looks like in the xml that 'select_one list_name' is the way to go. See image.

In the designer you'd just use a single choice format and that way only one can be checked at once.

0 Kudos
jcarlson
MVP Esteemed Contributor

Take a look at Choice Filters. Trying to filter a question based on its own choices gets pretty wonky, and is not likely to work right. I can get a question to hide the other options when "none of the above" is checked, but the question "locks" after the initial selection, and I cannot check or uncheck anything. The GIF below doesn't show my clicks, but I'm trying my best to change the selection:

Survey123Connect_MHVLGjcmOa.gif

Best practice would be to have your choice filter operate on a separate question. You could break question 24 into two parts, perhaps. Have a select_multiple with all the problems except for the exclusive choices. Then put a select_one with "none of the above" and "prefer not to answer" immediately after it.

In my test form, my second question is called choices_exc, with the values being "none" and "no_answer". Then, in the choice_filter column of the main question, I have the expression not(selected(${choices_exc}, 'none') or selected(${choices_exc}, 'no_answer')).

There's a gap between the choices which is kind of annoying, but sometimes function comes before form.

Survey123Connect_bOLgExq3av.gif

In order to still capture the data, you could add some calculation logic to the main question to pipe in the selection from choices_exc if one is selected.

- Josh Carlson
Kendall County GIS
mattCSimon1
Emerging Contributor

thanks Josh! I like the second option you came up with. the visual gap is a bother but not too bad.  

0 Kudos
Richard_Purkis
Esri Contributor

Hi @mattCSimon1 

Another user posted a similar question in this thread Multiple Choice Contstraint. I would check out the solution there.

In short there is no way that other boxes can be unchecked automatically. It is easy though to set up a validation check for certain options to be exclusive.

Hope this helps

mattCSimon1
Emerging Contributor

Thank you for confirming this Richard so I can move on with the solution Josh* suggested above.  

0 Kudos