Skip to content

Conditional fields

Forms and configurationDashboardHTTPx-lt-showIfx-lt-hide-if-emptyx-lt-hiddenenforce_schema

A field appears only when a condition holds, live as the person types, and a hidden required field is skipped by validation on both sides.

The situation

A rejection needs a reason; an approval does not. One form should ask for the reason only when the reviewer rejects, and the reason should be required exactly when it shows.

The recipe

form_schema
{
"title": "Quality review",
"x-lt-order": ["approved", "rejection_reason", "notes"],
"required": ["rejection_reason"],
"properties": {
"approved": { "type": "boolean", "description": "Approve this submission" },
"rejection_reason": {
"type": "string",
"format": "textarea",
"x-lt-showIf": "!resolver.approved"
},
"notes": { "type": "string", "format": "textarea" }
}
}

The value at the path is tested for truthiness; ! inverts. Equality forms compare a string: resolver.station=DRAFT, metadata.count!=3. An array requires every condition.

Domain Reads
resolver, input The live form values, reacting as the person edits
metadata, payload, envelope, escalation The stored row
roster A roster field’s counts, such as roster.orders.outstanding=0

The guarantee

Required validation is skipped for fields hidden at submission time. For roles with enforce_schema, the server evaluates the same conditions with the same shared pass, so a hidden field is optional and a shown required field is enforced through every surface, with the canonical 422 on a miss. In the workflow, treat the conditional fields as optional. See Forms.