Skip to main content

Conditional Logic

Show or hide fields based on what the visitor entered, and change what happens after submission. For example: show a budget field only when the inquiry type is "Request a quote", or email the sales team only when the visitor selects "Business".

Conditions can be used in three places. The rules are built the same way in all of them.

Applies toWhere to set itWhat it does
Field visibilityFields tab → the Conditions tab of each fieldShows or hides the field when the conditions match
Notification emailsForm Settings → EmailSends or skips an email, and changes its recipients
Post-submission actionForm Settings → SettingsSwitches the success message, completion page or redirect

Setting a condition on a field​

  1. Open the Fields tab in the form editor and expand the field you want to control
  2. Open its Conditions tab
  3. Check Show or hide this field depending on other answers
  4. Choose Show / Hide and all / any
  5. Click + Add condition and pick a field, an operator and a value
  6. Save the form

On the front end the field appears and disappears as the visitor types. No page reload is involved.

Using a field you just added

The choices of dropdowns and radio buttons are read from the saved form. If you use a field you added in the same editing session, the value box is a plain text input instead of a picker. Save the form once and you will be able to choose from the list.

Building the rules​

all / any​

  • all — every condition in the list must match (AND)
  • any — at least one condition must match (OR)

Available operators​

The operators offered depend on the type of the field you pick.

Field typeOperators
Dropdown, radio buttons, checkboxesis / is not / is empty / is not empty
Numberis / is not / is greater than / is greater than or equal to / is less than / is less than or equal to / is empty / is not empty
Acceptanceis not empty (= checked) / is empty (= unchecked)
Everything else (text, email, date, and so on)is / is not / contains / does not contain / starts with / ends with / is empty / is not empty

Details of how values are compared:

  • contains, starts with and ends with are case-insensitive
  • Size comparisons (greater than, and so on) only match when both the entered value and the comparison value are numbers. Otherwise they never match
  • For fields that allow multiple selections, such as checkboxes, a rule matches when any of the selected values matches. "is not" matches when none of the selected values is the given one
  • "is empty" only matches when nothing was entered. A value of 0 counts as not empty

Which fields can be used​

The field a rule looks at (the one you pick on the left of a rule) must be an ordinary field with a single value. These cannot be used:

  • Address, file upload, HTML, custom mail tag
  • Field groups and repeaters (including the fields inside them)
  • Page breaks

The field a condition is attached to — the one that gets shown or hidden — can be any field except a page break. Field groups and repeaters can be shown or hidden as a whole.

Chained conditions

The value of a field that is hidden by a condition is treated as empty. Chains work correctly: field A can depend on field B while B itself has a condition.

What happens to a hidden field​

A field hidden by a condition is treated as not filled in.

  • Submission is not blocked, even if the field is required
  • Its value is not stored with the submission
  • It does not appear on the confirmation screen, in notification emails or in CSV exports (it is also excluded from {all_fields})

This is enforced on the server as well as in the browser. Forcing a hidden field to appear with browser developer tools and submitting a value does not get that value accepted.

Sending different emails by condition​

Pro adds options to the Form Settings → Email tab.

Send condition​

Both the admin notification and the auto-reply have a Send condition. Check Send this email only when the conditions below match and add your conditions; when they do not match, that email is not sent.

Example: send the auto-reply only when the inquiry type is "Download a brochure".

Recipient routing​

The admin notification also has Recipient routing, which changes where the email goes based on the answers.

  1. Click + Add recipient rule
  2. Set the conditions
  3. Enter the addresses under Recipients (separate several with commas; the {admin_email} tag inserts the site admin address)
  4. Choose Replace the recipients above or Add to the recipients above
  • Rules are applied in order, and every matching rule applies. If several "replace" rules match, the last one wins
  • You can add up to 5 rules
  • Entries that are not valid email addresses are ignored

Changing what happens after submission​

Pro adds a Conditional Completion Actions section below "After Submission" in the Form Settings → Settings tab.

  1. Click + Add conditional action
  2. Set the conditions
  3. Choose an Action Type (Message Only / Completion Page / Redirect URL)
  4. Enter the message, the completion page HTML or the redirect target
  • Rules are checked from top to bottom, and the first one that matches is used
  • If none matches, the "After Submission" setting above is used as usual
  • The success message and completion page HTML accept the same merge tags as the standard post-submission action

Combining with other features​

CombinationBehavior
Field groups / repeatersCan be shown or hidden as a whole. While hidden, nothing inside them is submitted. Conditions cannot be attached to individual fields inside a set
Multi-step formsFields hidden by a condition are skipped when "Next" validates the page. A whole page cannot be skipped
Reception controlWorks together. While reception is closed, the form itself is not displayed
Confirmation screenHidden fields do not appear on the confirmation screen

When you use an HTML template​

If you build your own layout with an input screen HTML template, conditional logic can only disable the inputs — it cannot hide them visually — unless the wrapping element is marked.

Add data-fplant-field="<field name>" to the element that wraps the field.

<div class="my-row" data-fplant-field="budget">
<label>Budget</label>
[fplant_field name="budget"]
</div>

This is not needed when you use the standard layout output by the free plugin (.fplant-field-group).

Limitations​

  • Address, file, HTML, custom mail tag, group, repeater and page break fields cannot be used as the field a rule looks at
  • Conditions cannot be set on a page break (skipping a whole page is not supported)
  • Conditions cannot be attached to individual fields inside a group or repeater
  • Conditional logic does not work in JavaScript embeds (the snippet for external sites). It does work in iframe embeds