Checkbox questions have unique logic that differ from Multiple Choice questions with a single answer.


Display Condition General Structure

 To create a display condition that will show a question if a particular option in a proceeding checkbox question is selected, the structure will look like this: selected(#form/checkbox_questionid, 'select_item_name')

Example: if you have the a checkbox question called "symptoms" and you want to show a text question called "symptoms_other" when the user selects the "other" choice, the logic would look like:

selected(#form/symptoms, 'other')

You can use the expression builder to make theses expressions - just make sure that in the drop-down you have selected "has selected value" instead of "is equal to"

Display Condition Referencing Number of Options Selected

To create a display condition for a question to show only if a certain threshold of a number of responses is selected you can also use the count-selected(). count-selected() is a way to reference the number of choices selected.

Example: to display a question only if at least 3 options have been selected from a previous checkbox question, use the display condition: count-selected(#form/some_checkbox_question) > 3. 

Validation Against Number of Options Selected

You can create a validation condition which limits the number of choices a user can select. This is also done using the "count-selected()" function. 

 Example: if you want a validation constraint that a user must select less than 3 options: count-selected(.) < 3

Validation Condition Preventing the Selection of None Along with Another Option

If you have a checkbox question which has "none" as one of the options you may want to prevent your user from selecting both "none" in addition to another choice. 

Example: Validation condition for a question with a choice that has the item value "none":  not(selected(., 'none') and count-selected(.) > 1)

This essentially says "do not allow the user to choose both "none" and an additional item.

Validation Condition for Surveys

 A standard survey question may have the answers "Yes", "No", and "(Optional) Additional Comments." With this, you'd want the respondent to 1) be able to select yes and no 2) and would want them to also add in comments. 

Example: You can use validation logic in the following way: (not(selected(., 'yes') and selected(., 'no'))) and (not(selected(., 'comments') and count-selected(.) < 2))

  • No labels