What is Field Validation?
Field Validation enables you to add special restrictions or limitations to certain fields on a form, which require the data input by the customer to match the specific conditions you define. The available validation rules vary based on the data type for each field (email fields, number fields, dates fields, etc.), so you can easily make sure you're receiving meaningful data from your customers when they fill out a form.
How do I add validation for a field?
To get started with field validation, simply click on any field in the form builder to open the 'Edit field' panel. You can then scroll down to the 'Validation' section:
Important note: Make sure you type in an error message when setting up field validation, otherwise the validation will be ignored!
Types of field validation
Set field as 'required'
Almost every field type has a setting you can enable to make a field required. You can also edit the 'required' error message for each field.
Field-specific validation rules
There are some global validation rules that work across multiple field types, however, some fields offer special validation rules that not applicable to other fields. Below you'll find some quick insights into each data type:
Must equal x
Must contain x
Must be longer than x characters
Must match regular expression
Must be a valid email address
Domain must equal (see also: restrict aol and yahoo email addresses)
Greater than/Less than
Must equal/Must not equal
Greater than or equal to/Less than or equal to
Special validation examples (there are more options than displayed here):
Must be more than x years ago
Must be less than x days from now
Must be before [date]
Must be on or after [date]
File upload fields
[File size] must be larger than/smaller than
Extension must be (use comma separation to allow multiple types)
Checkbox (True/False) fields
Must be true
Must be false
Password & Password confirmation fields
Password fields must always be at least 5 characters as this is the standard that Shopify has set. However, you can increase the number of characters required or read about how to require strong passwords.
Validation is disabled for password confirmation fields, since the value must always match the "Password" field.
Nice work! That's all there is to know about Field Validation 😃
If you want to make a field optionally required based on other criteria, read about form rules.
Are we missing something?
If you have an idea for field validation that we're currently missing, please let us know!