Hello!
I want to know if it is possible to limit number of responses for select many questions. For example, I have 5 choices and I only want respondents to select only 2, Thank you in advance for your suggestions.
Hello!
I want to know if it is possible to limit number of responses for select many questions. For example, I have 5 choices and I only want respondents to select only 2, Thank you in advance for your suggestions.
Try this - you can add a constraint to your select_multiple like:
constraint: "count-selected(.) = 2"
Sample form:
countselected.xls (5.5 KB)
See count-selected() for details. BTW if you want at most 2 then use ‘<=’
Thank you very much!
Hello
I have a follow-up question, I understand the count-selected
( multi_select_question ) function will return the number of choices selected. What if you want to limit the total number of responses that can be selected say to 2 out of 5 responses. I have tried the recommendation but I can still select more than 2 choices, please help.
Hi @Dexter,
Welcome to the community! Follow the instructions outlined by Xiphware in post 2. It should solve your issue. However, if it does not, please feel free to share your xlsform with the multiple select question here so that we could correct the syntax error from your xlsform.
Have a great day!
thank you @Kal_Lam
This was solved.
Hi, I have the same question but I’m not building my survey in xls, I’m using the online form builder. Where do I enter this constraint, and what is the syntax?
I want to restrict it so that respondents can select a maximum of 5 choices, I’ve tried entering the below into the Validation Code box but it then doesn’t allow for anything to be selected:
constraint:count-selected(.)<=5
(I’ve also tried various other permutations of the same, with spaces and quotation marks etc, but no joy. Do I need to replace the “.” in the line with the actual label of the question? I’ve tried that too…)
Oh, I’ve got it to work, just using the below if anyone else comes across this:
count-selected(.)<=5
I swear that was the very first thing I tried after the above didn’t work, don’t know what the issue was but it’s working now!
Welcome to the community, @danburwood!