Conditional Logic in Forms: The Complete Guide

7 min readUpdated August 2026The HelloForms team

Conditional logic is a set of IF/THEN rules that change a form while someone fills it in. A rule watches one or more answers, and when they match, it acts: showing or hiding a field, making it required, jumping to another page, updating a calculation, or choosing who gets the notification email. Nothing changes until an answer matches.

That single idea replaces the two bad options every long form otherwise forces on you: ask everybody everything, or split the form into several forms and hope people pick the right one. A form with logic asks four questions of the person who only needs four, and eighteen of the person who needs eighteen.

What conditional logic actually does

Every rule in HelloForms has the same anatomy, and it helps to name the parts because the builder uses these words too:

PartMeaningExample
IFThe field being watchedDo you have pets?
STATEThe comparisonis equal to
VALUEWhat you compare againstYes
DOThe action takenShow "Pet details"

Read together: IF Do you have pets? is equal to Yes, show Pet details. The builder writes each saved rule back to you as that sentence, so you can check the logic without reading a table of settings.

Two properties make the engine predictable. First, rules are re-evaluated after every keystroke and selection, not just on submit. Second, they are evaluated together rather than in sequence — the engine keeps re-running the whole rule set until nothing more changes, so a rule that depends on a field another rule just revealed still resolves correctly.

The six rule types

HelloForms groups actions into six types. Almost every real form uses the first two, and the rest exist so you never have to fake them.

  1. Show or hide a field. The workhorse. Reveal a follow-up question, a file upload, or a whole section based on an earlier answer.
  2. Require or un-require a field. Make an answer mandatory only when it matters — a purchase order number when the payment method is "invoice", for example.
  3. Skip to a page. Send people down different paths through a multi-page form, so a returning customer never sees the new-customer questions.
  4. Update or calculate a field. Total a basket, price an option, work out a duration, or copy a value into a read-only summary field.
  5. Change the thank-you page. Show a different confirmation, a booking link, or a download depending on what someone chose.
  6. Send a different notification email. Route the submission to the right team or the right inbox based on an answer such as region or enquiry type.

Each of these has its own guide in this cluster, linked from the guides hub, and every one of them is built from the same IF/STATE/VALUE/DO anatomy above.

Building your first rule

The quickest useful rule is a follow-up question. Here is the whole process on a contact form:

  1. Open the form in the builder and add the trigger field — a Yes/No question such as Have you worked with us before?
  2. Add the field you want to reveal, for example Which project was it?
  3. Open the Conditions panel in the right-hand properties pane and choose Add rule.
  4. Set IF to Have you worked with us before?, STATE to is equal to, and VALUE to Yes.
  5. Set the action to Show and pick Which project was it? as the target.
  6. Use Test this condition to try sample answers without leaving the builder. Set the trigger to Yes and confirm the follow-up resolves to visible; set it to No and confirm it disappears.
  7. Save, then open the form's preview and fill it in as a reader would.

That last step matters more than it sounds. The test panel proves the rule resolves; the preview proves the form still reads well when the field appears, which is a design question rather than a logic one.

Choosing the right comparison

The STATE list is longer than most people expect, and picking the right one prevents most logic bugs. The comparisons fall into four families:

  • Equality — is equal to, is not equal to. Best for single-choice questions with a fixed option list.
  • Text matching — contains, does not contain, starts with, ends with. Useful for free-text triage, and for checkbox groups where you care about one selected option among several.
  • Emptiness — is filled, is empty. The right choice when any answer should move the form on, whatever the answer is.
  • Numbers and dates — greater than, less than, is between, is before, is after. Use these for quantities, budgets, ages and booking windows.

Any versus all

A rule can watch more than one field. The link toggle decides how the conditions combine:

  • All — every condition must be true. Narrow and specific: IF country is UK AND order total is greater than 100, show free-delivery notice.
  • Any — one condition being true is enough. Broad: IF enquiry type is Complaint OR urgency is High, require a phone number.

If you find yourself building one rule per option of the same dropdown, that is usually a single Any rule with several conditions instead. Fewer rules are easier to audit later.

Where logic goes wrong

Four failure patterns account for most of the "why is my field still showing?" reports:

  • A conflict. Two rules act on the same field in opposite directions and both match. The linter flags this, because the outcome depends on rule order rather than on your intent.
  • An orphan. A rule points at a field that has since been deleted, so it can never fire.
  • An unreachable field. Nothing in the form can ever reveal it — usually a field that was made conditional and then lost its trigger.
  • A loop. Field A's rule depends on field B, whose rule depends on field A. The engine stops safely, but the result is rarely what you wanted.

HelloForms runs a linter over your rule set as you edit and offers a one-click fix for each of these where a safe fix exists. It is the fastest way to inherit somebody else's form and understand it.

When not to use logic

Logic is not free. Every rule is a thing a future editor has to understand, and a form with forty rules is genuinely hard to change. Reach for something simpler when:

  • The form is short and every question applies to everyone. Just ask.
  • You are hiding a field for privacy. Hidden is not secret — remove the field or restrict who can see the submissions instead.
  • Two audiences share almost nothing. Two clear forms beat one form with two parallel paths.

FAQ

Does conditional logic work on mobile?

Yes. Rules are evaluated in the browser as answers change, so the behaviour is identical on a phone, a tablet and a desktop. Revealed fields push the rest of the form down rather than overlaying it, and the form scrolls to keep the field you are answering in view.

Do hidden fields still get submitted?

No. When a rule hides a field, its value is excluded from the submission, from calculations and from required checks. That means a hidden required field can never block a submit, which is the behaviour you want.

How many rules can one form have?

There is no practical limit — forms with dozens of rules run fine because the engine batches evaluation rather than re-rendering per rule. The limit in practice is human: past about twenty rules, consider splitting the form or replacing several rules with one Any rule.

Can a rule depend on a calculated field?

Yes. Calculations resolve before the rules that read them, and the engine re-runs until the whole set settles, so you can safely show a field when a calculated total goes above a threshold.

Will logic slow the form down?

No measurable amount. Rules are evaluated locally with no network request, so there is no round trip between answering a question and seeing the form respond.

Try it on a real form

These templates already ship with the logic described above. Open one, fill it in, and watch the rules fire — no account needed.

Browse every template

Was this guide helpful?