Dynamic Forms: Conditional Logic
Conditional Logic lets you configure a form to show or hide items depending on a user's selections. You can easily show or hide fields, change a field name, or send a specific response based on a user's response.
Any form component can use conditional logic to determine when to hide or display itself. The settings for a conditional field, are configured on the component itself, and can be found by viewing the Conditional tab within the components settings.
The conditional logic is based on the following rules:
- Each field can hide or display.
- The visibility is dependent on another component defined within the form.
- The logic is activated when the configured field contains the plaintext value defined in the settings.
Single Category Fields
show = data["single-category"] == 1
Multi Category Fields
show = data["multi-category"] == true
Text & number fields
show = data["external-field-id"] == "value"
show = data["text-field"] == "hello"
The condition above will show the form component if the field with external ID "text-field" has input value "hello".
show = data["category-field-2"] == true || data["category-field-2"] == true
The condition above will show the form component if the 1st OR 2nd option of the category field with external ID "category-field-2" -field-1" is selected.
show = data["text-field-1"] == "yes" && data["category-field-1"] == true
The condition above will show the form component if the field with external ID "text-field-1" has input value "yes" AND if the 2nd option for field with external ID "category-field-1" is selected.
show = data["single-category"] != 1
The condition above will show the form component if the field with external ID "single-category" has an input value different from the 1st label.