For the complete documentation index, see llms.txt. This page is also available as Markdown.

Constraint

The constraint column is used to validate user input. It prevents the user from continuing until the answer meets a condition you define.

If the answer doesn't satisfy the constraint, a message defined in constraint_message is shown to the user.

📝 How constraints work

The value of the question is represented by a dot (.), which means “the current answer.” You build a logic expression using that value.

Constraints are commonly used to:

  • Set numeric ranges (e.g., age must be between 0 and 120)

  • Require matching formats (e.g., ZIP codes, emails)

  • Enforce dependencies (e.g., end date after start date)

type
name
label
constraint
constraint_message

integer

age

Your age

. >= 18 and . <= 99

Age must be between 18 and 99

text

zip

ZIP code

regex(., '^\d{5}$')

Enter a 5-digit ZIP code

text

email

Email address

regex(., '^[^@]+@[^@]+.[^@]+$')

Enter a valid email

date

end

End date

. >= ${start}

End date must be after start

☑️ Using the dot (.) in constraint

The dot . represents the value entered by the user for the current question. Use it inside functions and expressions:

  • . >= 0 — valid if value is 0 or higher

  • regex(., '^\d{5}$') — valid if it matches the pattern

🔠 Variable references

You can use ${question_name} to reference answers from other questions in the form. Make sure referenced questions appear earlier in the form.

Example:

  • . > ${min_age} — ensures current input is greater than a previously entered value

🔢 Operators and functions for constraints

Same as relevance, you can use:

=, !=, >, <, >=, <= and, or, not()

Function
Description
Example

regex()

Validates the format of a text input

regex(., '^\d{5}$') for US ZIP codes

string-length()

Checks the number of characters

string-length(.) <= 50

selected()

Checks if a choice was selected

selected(${choices}, 'option1')

today()

Gets the current date

. <= today()

now()

Gets current date and time

. <= now()

Last updated

Was this helpful?