Validation Rules
Ensure data quality with custom validation rules.
Validation rules ensure that submitted data meets your requirements. Beyond built-in field validation, you can create custom rules with conditions and custom error messages.
Built-in Validation
Each field type has automatic validation:
| Field Type | Built-in Validation |
|---|---|
| Valid email format | |
| URL | Valid URL with protocol |
| Number | Numeric value within range |
| Date | Valid date format |
| Phone | Contains digits |
| File | Type and size limits |
Custom Validation Rules
Add custom validation to any field:
- Select the field in the builder
- Go to the Validation tab
- Click Add Rule
- Configure the rule
- Save
Rule Structure
Each validation rule has:
- Condition: When to show an error
- Message: Error message to display
The rule triggers when the condition evaluates to true for an error state.
Creating Validation Rules
Simple Value Check
Validate the current field’s value:
Rule: length_lt → 10
Message: "Must be at least 10 characters"
Cross-Field Validation
Validate based on other fields:
Rule: "confirm_email" neq "email"
Message: "Email addresses must match"
Conditional Validation
Only validate when certain conditions are met:
IF "country" = "United States"
THEN validate "zip" matches pattern "^\d{5}(-\d{4})?$"
Message: "Please enter a valid US ZIP code"
Validation Operators
All conditional logic operators work for validation:
Text Validation
| Operator | Use Case |
|---|---|
matches_pattern | Regex validation |
contains | Must include substring |
starts_with | Must begin with prefix |
ends_with | Must end with suffix |
Numeric Validation
| Operator | Use Case |
|---|---|
gt / gte | Minimum value |
lt / lte | Maximum value |
eq / neq | Exact value match |
Length Validation
| Operator | Use Case |
|---|---|
length_gt / length_gte | Minimum length |
length_lt / length_lte | Maximum length |
length_eq | Exact length |
Format Validation
| Operator | Use Case |
|---|---|
is_email | Valid email |
is_url | Valid URL |
is_number | Numeric value |
is_integer | Whole number |
is_alpha | Letters only |
is_alphanum | Letters and numbers |
Error Messages
Writing Good Error Messages
- Be specific about what’s wrong
- Tell users how to fix it
- Avoid technical jargon
- Keep it brief
Good:
“Phone number must include area code (e.g., 555-123-4567)”
Bad:
“Invalid format”
Dynamic Error Messages
Include field values in messages using templates:
Message: "Value must be greater than {{ min_value }}"
When Validation Runs
Client-Side (Form Widget)
- On field blur (when user leaves field)
- On form submission attempt
- Immediate feedback to users
Server-Side (Always)
- When entry is created or updated
- When workflows modify values
- When entries are imported
Validation States
Entry Status
| Status | Meaning |
|---|---|
| Valid | All rules pass |
| Invalid | One or more rules fail |
| Pending | Async validation in progress |
Field Status
Each field shows:
- Error message if invalid
- Success indicator if valid (optional)
- No indicator if untouched
Common Validation Patterns
Password Requirements
Rule 1: length_lt → 8
Message: "Password must be at least 8 characters"
Rule 2: not matches_pattern → "[A-Z]"
Message: "Password must include an uppercase letter"
Rule 3: not matches_pattern → "[0-9]"
Message: "Password must include a number"
Phone Number Format
Rule: not matches_pattern → "^\+?[\d\s-()]{10,}$"
Message: "Please enter a valid phone number"
Date Range
Rule: "end_date" lt "start_date"
Message: "End date must be after start date"
Unique Selection
For multiple selects or repeaters:
Rule: Check for duplicates
Message: "Each item must be unique"
Validation in Workflows
Workflows can also validate data:
On Submission
Trigger workflow on form submission to:
- Run complex validation logic
- Check against external data
- Validate across multiple forms
Validation Step
Add a condition step that:
- Checks validation rules
- Updates entry status
- Sends notifications for invalid data
Best Practices
Layer Your Validation
- Field-level for basic format
- Custom rules for business logic
- Workflow for complex validation
Be User-Friendly
- Validate early and often
- Show all errors at once
- Allow submission to save drafts
Test Edge Cases
- Empty values
- Boundary values (min/max)
- Special characters
- Very long inputs
Performance
- Avoid expensive regex patterns
- Limit cross-field validations
- Consider async validation for heavy checks