Show or hide form fields with conditional logic
Use conditional logic to show or hide a form field based on how a visitor answers another field. This guide explains how to set up conditions, which operators each field type supports, and what happens to hidden fields when a visitor submits the form.
Conditional logic is available on every Jetpack form.
What conditional logic does
Conditional logic (also called conditional fields or show/hide rules) lets the answer to one field decide whether another field appears on your form. For example, a photography booking form can ask for a wedding date only when the visitor selects “Wedding” as the type of shoot.
Each rule belongs to the field it controls:
- A field set to Show this field is hidden until its conditions are met.
- A field set to Hide this field is visible until its conditions are met.
- A field without conditions is always visible.
Fields appear or disappear as soon as the visitor changes an answer. The page does not reload.
Add conditional logic to a field
To show or hide a field based on another field’s answer:
- Open the post or page that contains your form, or open the form from Jetpack → Forms.
- Select the field you want to show or hide.
- Click the Add conditional logic icon (an eye) in the block toolbar. You can also open the Conditional logic panel in the block settings sidebar and click Add conditions.
- Under Action, choose Show this field or Hide this field.
- Under When, choose if any to act when at least one condition is true, or if all to act only when every condition is true.
- Choose a Field to check, an Operator, and a Value. For Dropdown, Single Choice, Multiple Choice, and Rating fields, you pick the value from that field’s options instead of typing it.
- To add another condition, click Add condition and repeat step 6.
- Click Done.
- Click Save or Publish to keep your changes.
After you click Done, the Conditional logic panel describes the rule in plain words. For example: This field is shown if any of these are true: What kind of shoot? is “Wedding”. To change the rule, click Edit conditions.
Fields you can use with conditional logic
Every form field supports conditional logic except the Image Select field and the Custom HTML field. A supported field can be shown or hidden by its own conditions, and other fields’ conditions can check its answer. A field cannot check its own answer.
Each field that a condition checks needs a unique Name/ID. If two fields share the same Name/ID, the conditions dialog lists them as unavailable. Click Make it unique, or give each field its own Name/ID under Advanced → Name/ID in the field’s block settings.
Operators available for each field type
The operators you can choose depend on the type of field you are checking:
- Text Input, Name, Email, Website, Phone Number, and Multi-line Text: is, is not, contains, does not contain, is empty, is not empty.
- Dropdown and Single Choice (Radio): is, is not, is empty, is not empty.
- Multiple Choice (Checkbox): contains, does not contain, is empty, is not empty.
- Number Input and Slider: equals, does not equal, is greater than, is less than, is at least, is at most, is empty, is not empty.
- Rating: equals, does not equal, is greater than, is less than, is at least, is at most, is empty, is not empty. The value list runs from 1 to the field’s maximum rating.
- Date Picker and Time Input: is, is not, is before, is after.
- Checkbox and Terms Consent: is checked, is not checked.
- Hidden Field: is, is not, contains.
- File Upload: is empty, is not empty.
How hidden fields affect form submissions
When a visitor submits the form, Jetpack checks every condition again on the server. A field that is hidden at that moment is handled as if the visitor was never asked:
- It is not validated, so a hidden required field does not block the submission.
- Its answer is not saved. It does not appear in the response under Jetpack → Forms → Responses, in the notification email, or in data sent to integrations.
- It counts as empty for other fields’ conditions. If a visitor fills in a field and then changes an answer that hides it, conditions that check the hidden field treat it as unanswered.
Conditional logic in multistep forms
Conditions can check fields on any step of a multistep form. The Field list groups fields by step. Check fields on the same step or an earlier step. A condition that checks a field on a later step compares against an empty value, because the visitor has not answered that field yet.
When conditions are not applied
- If you delete a field that a condition checks, that condition is ignored. If every condition on a field is ignored, the field is always visible. The conditions dialog shows “The referenced field no longer exists” so you can pick another field or remove the condition.