In this article
Question q5 of the car survey is a Multi question that asks, “What cars have you test driven?” - .
Figure 1 - The q5 answer options
The codes on the cars here are 1,2,3,4,5,6 (in the order shown).
Checking Specific Answers in a Multi question
If you wish to perform specific checks in this Multi question, for example to check if only one of the six car brands was selected, you would use the following expression:
if (parseInt(q5_1) + parseInt(q5_2) + parseInt(q5_3) + parseInt(q5_4) + parseInt(q5_5) + parseInt(q5_6) == 1) { }If you wish to check if for example either GMC OR Cadillac was selected:
If ( q5_1 == "1" || q5_2 == "1" ) { }Setting a Value in a Multi Question
For setting specific answers in a Multi question, you set 0 for "not selected" and 1 for "selected".
q5_1 = q5_2 = "0";
q5_3 = "1";
This would set GMC and Cadillac to "not selected", and Volvo to "selected", while other answers will remain unchanged.