...
For example, imagine you have two questions
Question ID | Question Text |
---|---|
/data/color | What is your favorite color? |
/data/food | What is your favorite food? |
In this scenario you want the user to answer exactly one of of these, though the user can answer either one.
...
The simplest solution would be to add a question beforehand which asks:
Question ID | Question Text |
---|---|
/data#form/select-question | Which question do you want to answer?
|
This question would be required, and then you could use the display conditions to show exactly one question, which would also be required.
Option 2: Allow Users to See All Questions - Using a label as a validation condition
Sometimes you want the users to be able to see all of the possible questions before choosing which one to answer. Here is a way to do that:
...
2. Create a Label after the Questions, but but still in the Question List Group
...
You will want the display condition to show the label when you don't answer exactly one of them. For example:
(#form/data/color != '' and /data#form/food != '') or (/data#form/color = '' and /data#form/food = '')
4. Set the Label's Validation Condition
We want to treat the label like a validation condition so put a validation condition that can never be met. For example:
1=2
Set the label's validation message to be: "You must answer exactly one of the above questions."
Now when the user doesn't answer exactly one question they will see an error message which prevents them from going forward until they correct it.