Skip to main content
By adding validation rules to your questions, you can improve data quality, reduce errors, and create a better survey experience. Validation Rules Editor

How Validation Rules Work

Validation rules are evaluated when a respondent submits their answer. If the answer doesn’t meet the validation criteria, an error message is displayed and the respondent must correct their input before proceeding. You can combine multiple validation rules using All are true or Any is true logic:
  • All are true: All rules must pass for the response to be valid
  • Any is true: At least one rule must pass for the response to be valid

Available Validation Rules by Question Type

Free Text Questions

Free text questions support different validation rules based on the input type:

Text Input Type

RuleDescriptionExample
At least (characters)Requires at least N charactersAt least 10 characters for detailed feedback
At most (characters)Limits response to N charactersAt most 500 characters for short answers
Matches Regex PatternMatches a regular expression patternCustom format validation
IsExact match requiredMust equal “CONFIRM”
Is notMust not match the valueCannot be “N/A”
ContainsMust include the substringMust contain “@company.com”
Does not containMust not include the substringCannot contain profanity

Email Input Type

Email input automatically validates email format. Additional rules available:
  • At least, At most (characters)
  • Matches Regex Pattern, Is, Is not
  • Contains, Does not contain

URL Input Type

URL input automatically validates URL format. Additional rules available:
  • At least, At most (characters)
  • Matches Regex Pattern, Is, Is not
  • Contains, Does not contain

Phone Input Type

Phone input automatically validates phone number format. Additional rules available:
  • At least, At most (characters)
  • Matches Regex Pattern, Is, Is not
  • Contains, Does not contain

Number Input Type

RuleDescriptionExample
At leastNumber must be at least NAge must be at least 18
At mostNumber cannot exceed NQuantity at most 100
IsNumber must equal NQuantity is 1
Is notNumber must not equal NCannot be 0

Multiple Choice (Multi-Select) Questions

RuleDescriptionExample
At least (options selected)Require at least N selectionsAt least 2 options selected
At most (options selected)Limit to N selectionsAt most 3 options selected

Picture Selection Questions

RuleDescriptionExample
At least (options selected)Require at least N picturesAt least 1 design selected
At most (options selected)Limit to N picturesAt most 2 favorites selected

Date Questions

RuleDescriptionExample
Is later thanDate must be after specified dateMust be after today
Is earlier thanDate must be before specified dateMust be before Dec 31, 2025
Is betweenDate must be within rangeBetween Jan 1 and Dec 31
Is not betweenDate must be outside rangeCannot be during holidays
Date values should be specified in YYYY-MM-DD format (e.g., 2025-01-15).

Matrix Questions

RuleDescriptionExample
Minimum rows answeredRequire at least N rows to be answeredAnswer at least 3 rows
Answer all rowsAll rows must have a selectionComplete the entire matrix

Ranking Questions

RuleDescriptionExample
Minimum options rankedRequire at least N items to be rankedRank your top 3
Rank all optionsAll options must be rankedRank all 5 items

File Upload Questions

RuleDescriptionExample
File extension isOnly allow specific file typesOnly .pdf, .docx allowed
File extension is notBlock specific file typesNo .exe files
File size limits are configured separately in the question settings using the “Maximum file size” option.

Address Questions

Each address field (Address Line 1, Address Line 2, City, State, ZIP, Country) can have its own validation rules:
  • At least, At most (characters)
  • Matches Regex Pattern
  • Is, Is not
  • Contains, Does not contain

Contact Info Questions

Each contact field can have specific validation rules: First Name, Last Name, Company:
  • At least, At most (characters)
  • Matches Regex Pattern, Is, Is not
  • Contains, Does not contain
Email: Automatically validates email format, plus text rules above Phone: Automatically validates phone format, plus text rules above

Adding Validation Rules

1

Open the Question Settings

Click on the question you want to validate to open its settings panel.
2

Navigate to Validation Rules

Scroll down to find the “Validation Rules” section and click to expand it.
3

Add a Rule

Click the “Add rule” button to add a new validation rule.
4

Configure the Rule

Select the rule type from the dropdown and enter the required value (if applicable).
5

Set Logic (Optional)

If you have multiple rules, choose whether they should be combined with “All are true” or “Any is true” logic.
6

Save Your Survey

Click “Save” to apply the validation rules to your survey.

Error Messages

Formbricks automatically generates user-friendly error messages based on your validation rules. Error messages are displayed below the input field when validation fails. Example error messages:
  • “Must be at least 10 characters”
  • “Must be a valid email address”
  • “Please select at least 2 options”
  • “Date must be after 2025-01-01”

Multi-Language Support

Validation rules work with multi-language surveys. Error messages are automatically displayed in the respondent’s selected language.

Combining Multiple Rules

When using multiple validation rules: All are true: Use when all conditions must be met.
  • Example: Text must be at least 10 characters AND contain “@email.com”
Any is true: Use when any condition is acceptable.
  • Example: Date is earlier than 2025-01-01 OR is later than 2025-12-31