Add Conditional Logic to a Form
Conditions keep a form short until it needs to be longer. A field can be required only when an earlier answer matches, or shown only when an earlier answer matches, and a whole step can be shown only when it applies. This guide covers field visibility, conditional required rules, and step visibility.
Prerequisites
- The form exists, with both the field that drives the condition and the field or step it controls. See Create a Form.
- Your role has Configure Form on the form.
- For field conditions, the field that drives the condition is placed above the field it controls. Only fields above the selected field can be used.
Steps
Show a field only when it applies
Open the field
In the form builder, click the field to show or hide. The Configure Field drawer opens. Scroll to Rules.
Open the visibility settings
On the Visibility row (it shows Always show until you add a condition), click the settings (gear) icon. The Visibility Configuration builder opens.
Build the condition
On the Where row, pick the field in Select Field, an operator in Select Operator, and the value. Click Add Filter Condition to add another row, and choose AND or OR to combine rows. Click Add Nested Filter to group conditions.
Apply and save
Click Apply to keep the condition, then Update at the bottom of the drawer to save the field. Clear All removes the conditions; Cancel discards all changes in the drawer.
Make a field required only when it applies
Turn on Required
In the field's Rules, turn on Required.
Choose Based on the condition
Change the mode from Always to Based on the condition, then click the settings icon next to it. The Required Configuration builder opens.
Build the condition and save
Build the condition the same way as for visibility, click Apply, then Update.
A field that is always required cannot also have a visibility condition: the builder shows Visibility cannot be configured when the field is always required. Use Based on the condition with the same condition instead.
Show or hide a step
Open the step configuration
Open the step's ⋯ menu and choose Configuration.
Add visibility conditions
Under Visibility, click Conditions (it shows Always show until you add one). In Visibility Conditions, build the condition. Any field on the entity can be used. To hide the step from everyone, turn on Hide this step instead; conditions cannot be set while the step is hidden.
Save
Click Apply, then Save in the drawer.
Sections do not have their own conditions. To hide a group of fields, put them in their own step, or add the same condition to each field.
Operator reference
| Field kind | Operators |
|---|---|
| Text | contains, equals, does not equal, is empty, is not empty |
| Number | =, !=, >, >=, <, <=, is empty, is not empty |
| Date | is, date equals, is not, is after, is on or after, is before, is on or before, is empty, is not empty |
| Dropdown, Radio, Checkbox, and other choice fields | is, is not, is none of, is any of |
| Boolean | is (Yes, No, or None) |
| Time | is, is not, is empty, is not empty |
| Time Range | is, is not, start is, end is, start is not, end is not, is empty, is not empty |
Example
On a Building Permit Application:
| Field or step | Rule | Condition |
|---|---|---|
| Contractor (association) | Visibility | Owner Is Doing the Work is No |
| Demolition Plan (File) | Required, Based on the condition | Permit Type is Demolition |
| Demolition Plan (File) | Visibility | Permit Type is Demolition |
| Fire Protection step | Step Conditions | Occupancy Type is any of Assembly, Educational, Institutional |
Place Owner Is Doing the Work and Permit Type above the fields they control.
Common mistakes
- The trigger field is below the field. Field conditions can only use fields above the field. Move the trigger field up.
- Hiding a field that is always required. Applicants cannot submit a required field they cannot see. Use Based on the condition.
- Forgetting Update. Apply keeps the condition in the drawer; Update saves it to the form.
- Matching on text that varies. Conditions on free text are fragile. Use a Dropdown, Radio, or Boolean to drive conditions.