Guide · 6 min read
5 conditional logic examples for forms
Updated 2026-09-17
TL;DR
Conditional logic shows or hides a field based on an earlier answer — use it for follow-up questions, skipping irrelevant sections, and requiring detail only when it's needed.
Conditional logic is what turns a long, one-size-fits-all form into something that adapts to each respondent. Instead of showing every question to everyone, you set rules that reveal or hide fields based on what someone already answered. Below are five patterns you'll use in almost any form, from a simple follow-up question to branching a whole page — plus what to watch for so the logic stays easy to follow.
Follow-up question on a specific answer
The most common pattern: a question appears only when an earlier field equals a specific value. Ask "Do you have any dietary restrictions?" with a yes/no choice, then show a text field asking what they are only when the answer is "yes".
This keeps the form short for the majority who answer "no" while still collecting detail from the people it actually applies to.
Requiring detail when someone picks "Other"
When a select field includes an "Other" option, pair it with a text field that shows only when the select equals "Other". Mark that text field as required so people can't pick "Other" and leave you with no idea what they meant.
This combination — a fixed set of options plus one conditional catch-all — covers edge cases without cluttering the main choice list.
Branching by a rating or score
Numeric fields like a satisfaction rating or NPS score work well with "greater than" and "less than" conditions. Show a "What went wrong?" text field only when a rating is below a threshold, or a referral field only when it's above one.
This routes detractors and promoters into different follow-up questions without asking everyone the same thing.
Hiding an entire section by an earlier choice
Conditions apply per field, but you can hide several fields with the same rule to effectively hide a whole section. If someone answers "I'm applying as an individual" rather than "as a company", hide every company-specific field (registration number, company size, billing contact) at once.
Combine this with the "is empty" / "is not empty" operators to also handle fields that were skipped earlier in the form.
Combining multiple conditions
Conditions on the same field are AND-combined, so you can require several things to be true before a field appears — for example, show a "discount code" field only when a plan select equals "Pro" and a country field is not empty.
In YeetForm, conditions support 8 operators (equals, not equals, contains, greater than, less than, is empty, is not empty, and their combinations), and you can describe the behavior you want in plain English to the AI form-editing agent instead of wiring each rule by hand.