Sometimes you may have a set of questions and want to require the user to answer a subset of them. However, you want each user to be able to choose their own subset.
For example, imagine you have two questions
|color||What is your favorite color?|
|food||What is your favorite food?|
In this scenario you want the user to answer exactly one of these, though the user can answer either one.
Option 1: Add a Preceding Question
The simplest solution would be to add a question beforehand which asks:
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:
1. Put all of the Questions in a Question List Group (works on Android)
This will put all of the questions on the same page.
2. Create a Label after the Questions, but still in the Question List Group
This label will be displayed when someone does not answer exactly one question.
3. Set the Label's Display Condition
You will want the display condition to show the label when you don't answer exactly one of them. For example:
(#form/color != '' and #form/food != '') or (#form/color = '' and #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:
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.