Constraints on multi-select answers


So i have developed a questionnaire on via the builder, where some of the multi select question require certain restrictions.

if you see in the image below, the idea is that the respondent select the 2nd option (Willing to pay a premium), the 1st option (consider implementing) be selected by default, otherwise it would not make any sense, and if the respondent selects the 3rd options (would not consider), then both options above will automatically unchecked.

is there a validation code that would this possible via the builder ?
Screenshot 2024-06-26 171125

@archibald, I could clearly understand that you would require the following:

  • The first option be selected by default.
  • If you select the second option, the user should not be able to select the third option.

Is this your requirement?

Thank you for your prompt response Kal_Lam.

Not exactly, my requirement is:

  • First option can be selected alone.
  • If second option was selected, first option must be selected as well.
  • If third option is selected, than neither the first not the second option can be selected.

not(selected(.,‘2’) and not(selected(.,‘1’))) and not(selected(.,‘3’) and count-selected(.)>1)

I believe this validation code will meet your requirements.

Unfortunately did not work, i could still select all of them or any of them and still move on without any of the required restrictions.

Any further suggestions, please ?

not(selected(.,‘2’) and not(selected(.,‘1’))) and not(selected(.,‘3’) and count-selected(.)>1)
I tested and it work, please check:
giving xml vales, I gave option answer 1 as “1”, option answer 2 as ‘2’ and option answer 3 as ‘3’
Constraints on multi-select answers.xlsx (6.4 KB)

@archibald : I suggest you put single choice responses as below:

  1. consider implementing
  2. Consider implementing and willing to pay premiums
  3. Would not consider
1 Like

Thank you it worked, i forgot to set xml values :face_with_open_eyes_and_hand_over_mouth: