Skip to content

Conditional logic

A condition shows a field, or a whole section, only when the visitor’s other answers match rules you set. Everything else about the field stays the same; it simply appears and disappears as the visitor fills in the form.

  • A follow-up question that only applies to one answer: “Other — please specify”.
  • A group of questions for one kind of enquiry, in a section that appears when that kind is chosen.
  • Conditions change only what is shown. To email different people depending on an answer, see Email notifications.

Add conditions to the field or section that should appear. It holds a list of rules and how they combine:

{
"key": "other_detail",
"type": "text",
"label": "Please specify",
"required": true,
"conditions": {
"logic": "and",
"rules": [
{"field": "service", "operator": "equals", "value": "other"}
]
}
}
  • field is the key of the field to check.
  • value is compared with the stored value of an option, not its label.
  • logic is and (every rule must match, the default) or or (any rule).

The form re-checks the rules as the visitor types and chooses.

OperatorShorthandMatches when the checked field…
equals==, =is exactly value
not_equals!=, <>is anything but value
contains—contains value, ignoring case
not_contains—does not contain value, ignoring case
is_emptyemptyhas nothing entered or chosen
is_not_emptynot_emptyhas something entered or chosen
is_checkedcheckedis a single tick box that is ticked
is_not_checkednot_checkedis a single tick box that is not ticked
greater_than>is a number larger than value
less_than<is a number smaller than value
greater_than_or_equals>=is a number at least value
less_than_or_equals<=is a number at most value
in—is one of the values in a list: "value": ["a", "b"]
not_in—is none of the values in a list

An operator the form does not recognise counts as matching.

  • It is not required while hidden. The visitor can submit without it.
  • Its value is thrown away on submission, so it does not appear in the entry, the notification email or the webhook, even if the visitor typed something before it was hidden.
  • The server checks the rules again on submission; it does not rely on what the browser showed.
  • Checking a checkbox group. For a group where several boxes can be ticked, use contains (true when any ticked value contains value), is_empty or is_not_empty. equals compares one value and never matches a group. Use radio buttons or a dropdown when a condition needs exactly one chosen value.
  • The condition never matches. Check that field is the field’s key, and that value is the option’s value rather than its label.