Preview Form
When using the CommCare app builder you can use the Preview Form button. Click on the form settings page, and then the Preview Form button. The preview will open in a new tab. The Preview Form tool will always use the most recent saved version of the form (it does not matter whether or not you have made a new version of the app).
For more information see the Beginner Tutorial Part 4 - Testing in CloudCare.
If the project space has a Pro software plan or higher, CloudCare can be accessed for testing by clicking on CloudCare at the top of the page. Note that accessed CloudCare this way uses the most recent starred build.
Excel
A common way to make sure that your hidden value is working as expected is to create a "debug" label which displays the output of the hidden value. To do this for many hidden values at once, learn the technique available on the page Create a Large Debug Label with Excel.
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
Question ID | Question Text |
---|---|
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:
Question ID | Question Text |
---|---|
#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:
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:
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.