Conditional Logic: A Complete Guide
Learn how to use Instaform's conditional logic with 8 operators, AND/OR connectors, and 4 actions to create smart, adaptive forms that respond to user input.
Static forms treat every respondent the same. A CEO filling out a B2B inquiry sees the same fields as a freelancer. A customer reporting a billing error answers the same questions as someone with a technical bug. Every respondent walks the same path, regardless of who they are or what they need.
Conditional logic changes that. It turns a rigid questionnaire into an adaptive conversation that responds to each person's answers in real time. Fields appear, disappear, become required, or auto-populate based on what someone has already told you. The form becomes intelligent.
Instaform's conditional logic engine gives you eight operators, two logic connectors, and four actions to build forms that think. Here's how to use every piece of it.
The Eight Operators
Every conditional rule starts with a comparison. You're checking a field's value against a condition. Instaform gives you eight ways to make that comparison.
Equals is the most common operator. If someone selects "Enterprise" from a company size dropdown, show the fields for procurement contact details. If they pick "Freelancer," skip straight to project details. Exact match, no ambiguity.
Not Equals is the inverse. Show a field to everyone except those who chose a specific option. If the department is not "Engineering," hide the technical specification fields. This is useful when you want a rule that applies to most respondents but excludes a specific group.
Contains works with text fields. If someone's job title contains "Manager," show the team size question. This is more flexible than Equals because it catches variations — "Marketing Manager," "Senior Manager," "Manager of Operations" all match. It's partial matching for real-world messiness.
Not Contains excludes partial matches. If a company name does not contain "Agency," skip the client portfolio section. Useful for filtering out a category without having to list every possible variation.
Greater Than and Less Than handle numeric comparisons. If the budget field is greater than 10,000, show the enterprise onboarding section. If the team size is less than 5, skip the department hierarchy questions. These operators work with number fields, slider values, and NPS ratings.
Is Empty and Is Not Empty check whether a field has any value at all. If the phone number field is empty, show a message asking for an alternative contact method. If the file upload field is not empty, show a confirmation message with next steps. These are particularly useful for optional fields where the presence or absence of data changes the flow.
AND/OR: Combining Conditions
Single conditions handle simple branching. Real forms need compound logic.
AND requires all conditions to be true. Show the enterprise pricing section only when the company size equals "500+" AND the budget is greater than 50,000 AND the timeline is not "Just exploring." All three must match. This creates precise targeting — you're narrowing the audience for a field to exactly the right respondents.
OR requires at least one condition to be true. Show the consultation booking link when the inquiry type equals "Custom Development" OR the budget is greater than 25,000 OR the company size equals "Enterprise." Any one match is enough. This creates wider nets — you're catching multiple signals that indicate the same intent.
You can mix AND and OR in the same rule set to build sophisticated logic trees. A field might show when (department equals "Sales" OR department equals "Marketing") AND (team size is greater than 10). The parenthetical grouping lets you express complex business rules without complex configuration.
The Four Actions
Once your conditions evaluate to true, you need something to happen. Instaform gives you four actions.
Show
The most common action. A field starts hidden and appears when conditions are met. Select "Yes" for international shipping, and address fields for country, postal code, and customs information appear. Select "No," and those fields stay invisible. The respondent never sees irrelevant questions.
Show actions keep forms short by default and expand them only when necessary. A form that might have forty fields across all scenarios shows only the fifteen that matter to each individual respondent. Completion rates go up because nobody feels overwhelmed by fields that don't apply to them.
Hide
The inverse of Show. A field starts visible and disappears when conditions are met. This is less common but useful for removing default fields in specific scenarios. If someone indicates they're an existing customer, hide the "How did you hear about us?" field — you already know.
Require
Make a field mandatory based on context. The phone number field is optional by default, but if someone selects "Phone" as their preferred contact method, the phone number field becomes required. This avoids the frustration of making everything required upfront while ensuring you collect essential information when it matters.
Require actions pair well with Show actions. Show the phone field when contact preference equals "Phone," then require it in the same scenario. The field appears and demands a response in one smooth interaction.
Set Value
Automatically populate a field based on other answers. If someone selects "Premium" as their plan tier, set the support level field to "Priority." If the country equals "United States," set the currency field to "USD."
Set Value reduces manual input and prevents inconsistencies. It's especially powerful for internal fields that the respondent doesn't see — you can auto-tag submissions, auto-assign categories, or pre-fill routing information based on the answers given.
Field-to-Field Conditions
Most conditional logic systems compare a field to a static value: "If Country equals United States." Instaform also supports field-to-field conditions, where you compare one field's value against another field's value.
This opens up scenarios that static comparisons can't handle. Compare a "Start Date" field against an "End Date" field to validate that the end date comes after the start date. Compare a "Budget" field against a "Minimum Spend" field to show a warning when the budget falls below the threshold.
Field-to-field conditions are particularly useful in order forms, booking systems, and any scenario where two user inputs need to be validated against each other rather than against fixed values.
Practical Examples
Lead Qualification Form
Start with three fields: Name, Email, and "What best describes your role?" The role field drives everything else.
- If role equals "Business Owner," show fields for company size, industry, and annual revenue. If annual revenue is greater than 1,000,000, show the enterprise contact section and set the lead priority to "High."
- If role equals "Marketing Manager," show fields for team size and current tools. If current tools contains "Competitor X," show the migration assistance offer.
- If role equals "Student" or role equals "Just Exploring," hide the budget fields and show a link to free resources instead.
One form serves three completely different audiences without any of them seeing irrelevant questions.
Event Registration With Tiers
A conference registration form with conditional pricing and logistics.
- If ticket type equals "VIP," show meal preference, workshop selection, and hotel booking fields. Require the dietary restrictions field.
- If ticket type equals "Virtual," hide all physical logistics fields and show the timezone and streaming platform preference fields.
- If attendee count is greater than 5, show the group discount code field and set the registration type to "Group."
Customer Support Intake
A support form that routes and triages automatically.
- If issue type equals "Billing," show account number and transaction date fields. Set priority to "Medium."
- If issue type equals "Technical" AND severity equals "Critical," set priority to "Urgent" and require the environment details field.
- If issue type equals "Feature Request," hide the severity field entirely and show a voting/priority field instead.
Best Practices
Start with the end state. Before building conditions, map out every possible path through your form. How many distinct audiences are you serving? What does each audience need to see? Sketch the tree before you build it.
Keep conditions shallow. Three levels of nested conditions are manageable. Seven levels become impossible to debug. If your logic is getting deeply nested, consider splitting the form into multiple forms — one per audience segment — with a short routing form in front using conditional logic to direct traffic.
Test every path. Use Instaform's preview mode to walk through each branch of your form. Enter values that trigger each condition. Verify that Show, Hide, Require, and Set Value all fire correctly. Check edge cases — what happens when a field is empty? When a number is exactly equal to your threshold?
Label your conditions. When a form has twenty conditional rules, you'll forget what each one does within a week. Use descriptive naming so that "Rule 7" becomes "Show enterprise fields for large companies."
Combine with analytics. After your form is live, use form analytics to see which paths respondents actually take. You might discover that ninety percent of respondents never trigger your most complex branch — and you can simplify accordingly.
Conditional logic transforms forms from static documents into dynamic experiences. The eight operators give you precision. AND/OR connectors give you complexity. The four actions give you control. Together, they let you build forms that are as smart as the conversations they replace.
Ready to try Instaform?
Join the waitlist and be the first to build forms that actually work for your business.