Configure Validations
Validations add client-side checks to question answers. When a validation fails, the user sees an error message and cannot proceed until they fix their input.
How to add validations
Section titled “How to add validations”- Open a question in your questionnaire
- Find the validations array field
- Add an entry for each validation rule
Each validation entry has:
| Field | Purpose | Example |
|---|---|---|
| op | The comparison operator | greaterThan, lessThan, equals |
| variable | The value to compare against | { type: "static", value: "2000-01-01" } |
| variableEqual | (for range checks) Second bound | { type: "static", value: "2026-12-31" } |
| message | Error text shown to the user | “Date must be after January 2000” |
Common validation patterns
Section titled “Common validation patterns”Date range check
Section titled “Date range check”Ensure a date is within an acceptable range:
| Field | Value |
|---|---|
| op | greaterThan |
| variable.type | static |
| variable.value | 2000-01-01 |
| message | Date must be after January 1, 2000 |
Add a second validation for the upper bound:
| Field | Value |
|---|---|
| op | lessThan |
| variable.type | static |
| variable.value | 2026-12-31 |
| message | Date must be before December 31, 2026 |
Minimum value check
Section titled “Minimum value check”Ensure a numeric input meets a minimum:
| Field | Value |
|---|---|
| op | greaterThan |
| variable.type | static |
| variable.value | 0 |
| message | Value must be greater than zero |
Compare against another answer
Section titled “Compare against another answer”Ensure one date comes after another:
| Field | Value |
|---|---|
| op | greaterThan |
| variable.type | dynamic |
| variable.value | coverageStartDate |
| message | This date must be after your coverage start date |
Validation vs. rules
Section titled “Validation vs. rules”| Feature | Validations | Rules |
|---|---|---|
| When evaluated | Before the answer is accepted | After the answer is submitted |
| Purpose | Prevent invalid data entry | Control navigation flow |
| User experience | Error message on the current screen | Redirect to a different question |
| Scope | Single field | Can reference multiple answers |
See also
Section titled “See also”- Validation Operators Reference – complete list of validation operators and examples
- Configure Rules – for flow control (as opposed to field-level validation)
- Rule Evaluation – understanding the difference between validation and rule evaluation