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

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

Multiple Choice (Multi-Select) Questions

Picture Selection Questions

Date Questions

Date values should be specified in YYYY-MM-DD format (e.g., 2025-01-15).

Matrix Questions

Ranking Questions

File Upload Questions

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