One of the most common uses for rules is to hide certain parts of a form unless a specific condition is met. This guide will show how to easily set this up using our Field Level Rules.
For this example, let's say you are creating an inspection form. For most inspections, you will only need to take photos or notes if there is an issue in an area. Users will get frustrated if there are hundreds of questions with comments and photo fields along side them, so let's hide those fields and only show them if the area fails the inspection.
1) First, all of your fields need to be created before you can create the rules. In order to show or hide fields, you need to be able to select them when setting up the rule. Here's how our sample form will look in the builder:
And below you will see this in the app. Notice how much screen space is taken up by fields we may or may not need.
2) Now that our fields exist, we can set up some rules. Lets start by clicking the little chess piece on one of our Pass/Fail fields.
Click on the Add Rule button to start building a rule.
Once you click Add Rule, you will see a number of other fields pop up. Some of them already have values selected, making what we are about to do extremely easy!
- When Kitchen: This refers to the field you have selected, it is the condition that should cause this rule to run. In this case it is "When Kitchen" because the name of the field we are on is "Kitchen." The options are Equals or Does Not Equal.
- Value(s): Allows you to choose what value(s), when selected in the field list, should cause the rule to run. This works with the first dropdown; together you select what values the rule should or should not equal in order to run.
- Perform Action: This is what should be done to the target field if the conditions in the first two drop downs are met. The options are Show, Hide, Enable, Disable, Required, or Not Required.
- Otherwise Perform: This is the setting the target field should have if the conditions of the rule are NOT met. This dropdown has the same options as Perform Action.
- On field or section: This is the target field or section that will be affected by the rule.
With the default settings for a new rule, all we need to do for a show/hide rule is add the Value and the Targets.
This rule is saying "When the Kitchen Pass/Fail field equals 'Fail,' show the Comments and Photos fields. If Kitchen is NOT Fail, hide the comments and photos fields."
3) That's it for one rule, but as you will notice below we have only set up this rule for one field. Now we need to add the rule to the rest of the Pass/Fail fields.
Once all those are added, the form will look much cleaner on the mobile app and be far easier to fill out.
4) We could say that the form is done here, but there is one last touch that can make forms like this even easier to use - we can color the hidden fields. This means that when a field was hidden and is suddenly shown, it will be very obvious to the user that a new field has appeared for them to fill out.
For this example, I am going to select blue on all of my comments and photo fields. See below how much more it stands out.
If you would like to learn more about rules, check out our Rules and Scripting page in the help center. If you have any issues setting up rules or with anything else regarding your form, just email firstname.lastname@example.org