Go to app

Conditional logic

Logic reacts to answers: show or hide blocks, make questions required, jump to a page, calculate values, or stop submission.


What logic can do

A logic block holds one or more rules. Each rule reads When these conditions are true, Do these actions.

ActionWhat it does
Show / HideShows or hides any block: a question, a paragraph, an image, or one option of a choice question.
Make required / Make optionalRequires a question on some paths only, or relaxes it on others.
Set next pageSkips to a page, so different answers lead down different paths.
Calculate valueWorks out a total, score, or price in a calculated field.
Set payment amountSets, raises, or lowers the price of a Payment question.
Prevent navigation to next pageStops the respondent from going on, with an optional message saying why.
Prevent form submissionStops submission until conditions are met, such as terms accepted, with an optional message saying why.

Add a logic block

A logic block sits on the canvas between questions, like any other block.

  1. 1

    Add a Logic block

    Click Logic in the Blocks tab, or type /logic on the canvas.

  2. 2

    Set the conditions

    Pick a question, an operator, and a value. Add condition adds another row.

  3. 3

    Choose actions

    Pick an action, such as Show or Set next page, and what it acts on: a question, block, option, or page.

  4. 4

    Add more rules (optional)

    One logic block can hold several rules, each with its own conditions and actions.

To show a block only sometimes, hide it with Hide in its block menu, then add a rule that shows it.

The Logic tab of the side panel lists every rule in plain words, such as When Plan is Pro, show VAT number. Click a rule to jump to it. Needs attention shows rules that point at a deleted question.

Conditions

A condition can read questions, hidden fields, calculated fields, and the respondent's language. With two or more conditions, click the And or Or pill to switch: with And all must be true, with Or one is enough.

Add a set of conditions adds a group with its own And/Or, for rules like “plan is Pro and (country is Norway or Sweden)”. A set cannot hold another set.

Plan is Pro and (country is Norway or Sweden): an And rule with an Or set inside.

Operators

The operators depend on the question. The main ones are below; most also have an opposite, such as is not empty. Text comparisons ignore capital letters and spaces at either end.

  • Text, email, web address, and phone: is, is not, contains, starts with, ends with, is empty.
  • Numbers, ratings, and scales: is, is greater than, is less than (or equal to), is between, is empty.
  • Dates and times: is, is before, is after, is between.
  • Radio Buttons and Dropdown: is, is not. Checkboxes and picture choice: has checked any of, all of, or exactly.
  • Others: Toggle Switch is on or off, Signature is signed, File Upload has file, Payment is completed, Ranking option is ranked first, Matrix row answer is.

Logic can show or hide Schedule appointment and Documents, but cannot read them. See Cal.com scheduling with logic.

When rules disagree

When two matching rules disagree, for example one shows a block and another hides it, the first rule in the form wins, and the editor flags the rule that never applies. To show a block for several answers, one rule with conditions joined by Or is easier to read than several rules.

Common patterns

Show a follow-up question

After a 1 to 5 Star Rating, a rule says: when rating is less than or equal to 3, Show “What could we improve?”.

Branch to different pages

An event registration form asks: “Are you attending in person or remotely?” Three rules follow:

  • When attendance is “In person”, Set next page “Venue details”.

  • When attendance is “Remote”, Set next page “Streaming setup”.

  • When arrival time is not empty, Set next page “Confirmation”. Arrival time is a required question on “Venue details”.

A jump happens when the respondent clicks Next on the page with the question it reads. The third rule lets in-person attendees skip “Streaming setup”, so both paths end on “Confirmation”.

Calculate a score and branch on it

Three Star Ratings add up into a calculated field, “Lead score”, with Calculate value. A second rule: when Lead score is greater than 12, Set next page “Priority follow-up”.

Stop submission below a total

When Order total is less than 10, Prevent form submission. Type the reason in Message shown to respondent, such as “Your order must total at least 10”, so they know what to change.

Test logic with Preview

Preview runs your logic. Fill in the form there to check every branch before you publish.

Next steps