Conditional Fields and Sections - Configuring Templates so that Fields or Sections are Shown or Hidden Based on Your Form's Data
Overview
It's now possible to configure your form templates so that fields or sections can be shown or hidden based on the data in your form. This is really useful in making forms easier to complete by ensuring that users only see relevant details and are not distracted by unnecessary information.
The 3 key components
There are 3 key components in using conditional fields and sections:
- Show/hide condition Formula field.
- This is a Formula field you will need add to the form.
- When this field evaluates to True, the relevant field(s) or section will be shown. Similarly, when this field evaluates to False, the relevant field(s) or section will be hidden.
- A form can contain one or more Show/hide condition Formula fields. For example, you can show/hide field A based on one Show/hide condition Formula field and show/hide field B based on a different Show/hide condition Formula field.
- More than one field can be shown/hidden based on the same Show/hide condition Formula field if needed.
- The Show/hide condition Formula field must be in the same form section as the field or section whose visibility it controls.
- For more information on configuring Formula fields, see:
- Field or section to be shown/hidden.
- This is the field or section that is shown or hidden based on the value of the Show/hide condition Formula field.
- There is no limit to the number of fields you can configure to be shown/hidden.
-
Show/hide condition setting for the field or section to be shown/hidden.
- Fields
- In the Advanced Settings of the field to be shown or hidden, there is a Show/hide condition setting. This is where you select the Show/hide condition Formula field that controls the visibility of the field to be shown/hidden.
- In the Advanced Settings of the field to be shown or hidden, there is a Show/hide condition setting. This is where you select the Show/hide condition Formula field that controls the visibility of the field to be shown/hidden.
- Sections
- In the Settings of the section to be shown or hidden, there is a Show/hide condition setting. This is where you select the Show/hide condition Formula field that controls the visibility of the section.
- In the Settings of the section to be shown or hidden, there is a Show/hide condition setting. This is where you select the Show/hide condition Formula field that controls the visibility of the section.
- Fields
Example
Let's imagine you're preparing the template for an Observation form. You want to ask the user filling in the form whether their observation was safe or unsafe. Only for unsafe observations, you want to show an additional “Safety Concerns” text area field. For safe observations, this field needs to be hidden.
To implement this you would...
- Add all editable fields to your form, including the ones that will be visible only if conditions linked to them are met. In this case, among others, you use a question “Safe or Unsafe?” and a text area “Safety Concerns”.
- Add a formula field (“Show Concerns”) that will define the visibility condition for the “Safety Concerns” text area.
- This field evaluates to True when a user answers the “Safe or Unsafe?” question as “Unsafe”, so the “Safety Concerns” text area will only be visible if a user flags the observation as Unsafe.
- In most cases you will want to permanently hide this formula from the fillable form to avoid user’s confusion.
- In the Advanced Settings for the “Safety Concerns” text area, select the reference to the “Show Concerns” formula as your linked condition.
- Save and publish the template.
How to configure fields to or sections be conditionally shown or hidden
- Make sure your form contains the fields that it needs to contain.
- Add a Formula field for each separate visibility condition needed.
- In Advanced Settings > Conditional Visibility > Show/hide condition setting of each field or section to be conditionally shown or hidden, select the relevant formula field.
- Save and publish the template.