Skip to content

Show when and Required when

Logic lives on each question and step: Show when (visibleWhen) and Required when (requiredWhen). Each holds a condition, written as JSON:

A question with logic
{
"kind": "field",
"key": "company",
"type": "text",
"label": "Company",
"visibleWhen": { "field": "contact_type", "op": "eq", "value": "business" },
"requiredWhen": { "field": "budget", "op": "in", "value": ["10k-25k", "25k-plus"] }
}

A step with visibleWhen is skipped when it’s false, which is how “skip to” works. Endings use when, and the first that matches is the thank-you that shows.

Condition
type Condition =
| { all: Condition[] }
| { any: Condition[] }
| { not: Condition }
| { field: string; op: "answered" | "empty" }
| { field: string; op: BinaryOp; value: string | number | boolean | string[] | [number, number] }
| { variable: string; op: NumericOp; value: number | [number, number] }
| { pricing: "subtotal" | "total" | "deposit"; op: NumericOp; value: number | [number, number] };
Conditions combined
{
"all": [
{ "field": "service", "op": "includes", "value": "design" },
{ "any": [
{ "field": "budget", "op": "gte", "value": 10000 },
{ "field": "rush", "op": "eq", "value": true }
] }
]
}
opThe answer…Suits
answeredhas a valueany question
emptyhas no value, or isn't showingany question
eqistext, number, one choice, tick box
neqis answered and isn'ttext, number, one choice, tick box
inis one oftext, one choice
notInis answered and isn't one oftext, one choice
includeshas this one pickedseveral choices
excludesis answered and doesn't have this one pickedseveral choices
includesAnyhas any of these pickedseveral choices
includesAllhas all of these pickedseveral choices
gtis more thannumber
gteis at leastnumber
ltis less thannumber
lteis at mostnumber
betweenis between two numbers, inclusivenumber
beforeis beforedate or time
afteris afterdate or time
onis ondate or time
containscontainstext
startsWithstarts withtext
endsWithends withtext

variable and pricing conditions take eq, neq, gt, gte, lt, lte and between. Text compares trimmed and ignoring case. Choices compare by option value. Dates can be relative (today, +7d), in the form’s time zone.

A question that’s blank, hidden or on a skipped step makes every operator false, except empty. That includes neq, notIn and excludes.

Condition
{ "field": "topic", "op": "neq", "value": "sales" }

is false while topic is blank. To include blank, say so with not:

Condition
{ "not": { "field": "topic", "op": "eq", "value": "sales" } }

A tick box always has a value (false counts), and so does a quantity (its default, or min). So “not ticked” is { "field": "invite", "op": "eq", "value": false }.

Where it is It can use
A block’s visibleWhen anything before that block
A question’s requiredWhen anything before it, and questions later in its own step
A step’s visibleWhen earlier steps
A step’s checks that step and earlier
Endings anything, including the price

Publishing refuses a form with a loop, or an operator that doesn’t suit its question.

Was this helpful?

Your answer goes straight to the person who wrote it.

Thanks. We read every note and update the article.

Thanks, that helps us keep these useful.

ChatGPT is a trademark of OpenAI, and Claude and Claude Code are trademarks of Anthropic. Other product names and logos belong to their owners. None of them makes or endorses Seaforms. Trademarks