Conditional Logic
Show or hide fields based on user input
Conditional Logic
This is a Pro feature. Upgrade to Pro to use conditional logic.
Conditional logic lets you show or hide fields based on what users enter in other fields. Create dynamic, personalized forms that adapt to user input.
How it works
- User fills out a field
- Conditions are evaluated in real-time
- Dependent fields show or hide instantly
- No page reload required
Setting up conditions
- Select the field you want to show/hide
- Click Conditional Logic in field settings
- Enable conditional logic
- Define your rules
Basic rule structure
IF [field] [operator] [value]
THEN [show/hide] this fieldExample:
IF "contact_method" IS "phone"
THEN SHOW "phone_number" fieldOperators
| Operator | Description | Example |
|---|---|---|
is | Exact match | country is "US" |
is not | Not equal | country is not "US" |
contains | Includes value | interests contains "sports" |
does not contain | Excludes value | interests does not contain "sports" |
greater than | Number comparison | age greater than 18 |
less than | Number comparison | budget less than 1000 |
is empty | No value entered | company is empty |
is not empty | Has any value | company is not empty |
Actions
Show field
Field is hidden by default, shown when conditions are met.
Action: Show
Default state: HiddenHide field
Field is visible by default, hidden when conditions are met.
Action: Hide
Default state: VisibleMultiple conditions
Combine conditions with AND/OR logic:
All conditions (AND)
All conditions must be true:
Show "corporate_fields" section when:
- company is not empty AND
- employees greater than 10 AND
- country is "US"Any condition (OR)
At least one condition must be true:
Show "contact_preferences" when:
- newsletter is checked OR
- updates is checked OR
- offers is checkedExamples
Contact method selection
Show appropriate field based on preferred contact method:
Fields:
contact_method(radio): Email, Phone, Mailphone_number(phone): Hidden by defaultmailing_address(textarea): Hidden by default
Conditions:
phone_number:
Show when: contact_method is "phone"
mailing_address:
Show when: contact_method is "mail"Email field is always visible (default).
Budget-based questions
Show different options based on budget:
premium_options:
Show when: budget greater than 5000
basic_options:
Show when: budget less than 1000
rush_available:
Show when: budget greater than 2000Business vs. personal
Different fields for business customers:
company_name:
Show when: customer_type is "business"
tax_id:
Show when: customer_type is "business"
job_title:
Show when: customer_type is "business"Checkbox expansions
Show details when checkbox is selected:
dietary_details:
Show when: has_dietary_restrictions is checked
accessibility_needs:
Show when: needs_accessibility is checkedNested conditions
Chain conditions for complex flows:
1. customer_type (radio): Personal, Business
2. business_size (select): Small, Medium, Enterprise
Show when: customer_type is "business"
3. enterprise_contact (text):
Show when: business_size is "enterprise"Form sections
Apply conditional logic to groups of fields using HTML dividers:
[HTML: <div class="business-section">]
Company Name
Tax ID
Employee Count
[HTML: </div>]
Condition on wrapper:
Show when: customer_type is "business"Validation & required fields
Conditionally hidden fields
When a field is hidden by conditional logic:
- It's not validated (even if marked required)
- Its value is not submitted
- It doesn't block form submission
Required when visible
Fields marked as required are only required when visible:
phone_number:
Required: Yes
Show when: contact_method is "phone"Phone is only required when the user selects "phone" contact method.
Best practices
Keep it simple
Complex conditional logic can confuse users. If you need many conditions, consider splitting into multiple forms.
Test thoroughly
- Test all possible paths through the form
- Verify hidden fields don't block submission
- Check mobile behavior
- Test with required fields
Performance
Conditions are evaluated on every field change. For forms with many conditions:
- Group related conditions
- Avoid deeply nested logic
- Test on slower devices
Troubleshooting
Field won't show
- Verify condition field ID is correct
- Check operator matches field type
- Test the source field has the expected value
- Clear browser cache
Field shows briefly then hides
This happens when JavaScript loads. The field's default state should match its expected initial state.
Required field blocking submission
Hidden fields should not block submission. If they do:
- Check the field is actually hidden (not just invisible CSS)
- Verify conditional logic is properly configured
- Check for JavaScript errors