Validation Flows
Validation flows allow you to create custom validation logic for your form questions. Instead of relying on basic validation rules like min/max length or regex patterns, you can build complex validation logic using the visual flow editor.
How Validation Flows Work
When a validation flow is attached to a question, it runs in two scenarios:
- Real-time validation - When the user finishes typing and moves away from the field (on blur)
- Form submission - When the user submits the entire form
The validation flow receives the current value of the question and must return either:
{ success: true }- The value is valid{ success: false, error: "Error message" }- The value is invalid with a custom error message and the form cannot be submitted.
Setting Up a Validation Flow
1. Create a Validation Flow
First, select the question you want to have custom validation. Go to the “Validation Flow” area in the advanced section. Click the “Select Validation Flow” button to open the flow selector. You can click ”+ Create New Flow” to create a new flow that will already be setup for validation, or you can select an existing flow (good for common validation).
2. Configure the Flow Input
Flows used for validating a question will receive two inputs; value and answers. value is the current value of the question you’re validating. answers is an object with key/value pairs of all your form questions and their answers. The answers parameter allows you to validate based on other questions’ values, enabling complex cross-field validation scenarios.
If you create a new flow from the form editor, these inputs will automatically be added.
3. Build Your Validation Logic
Add nodes to your flow to perform validation checks. Your flow will need to return success as a boolean. Set this to false if the current value isn’t valid. You can also return an error string, which will be shown to the user under the question.
Here is an example complex validation flow for an age question. It checks if a different question has “test” typed in it, and if so, it bypasses the validation.
