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.
| Action | What it does |
|---|---|
| Show / Hide | Shows or hides any block: a question, a paragraph, an image, or one option of a choice question. |
| Make required / Make optional | Requires a question on some paths only, or relaxes it on others. |
| Set next page | Skips to a page, so different answers lead down different paths. |
| Calculate value | Works out a total, score, or price in a calculated field. |
| Set payment amount | Sets, raises, or lowers the price of a Payment question. |
| Prevent navigation to next page | Stops the respondent from going on, with an optional message saying why. |
| Prevent form submission | Stops 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
Add a Logic block
Click Logic in the Blocks tab, or type /logic on the canvas.
- 2
Set the conditions
Pick a question, an operator, and a value. Add condition adds another row.
- 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
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.
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.
A hidden question has no value
When logic hides a question, its answer is ignored in conditions, calculations, and the payment amount, and is not saved. The same goes for questions on a skipped page. A hidden question is never required. Hidden fields always keep their value.
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.