Field Validations
Field validations allow you to control the accepted input of a field.
Validation types
Type | Description |
---|---|
Required | A value must be present. |
Unique | No other entry may have an identical value defined for that field. |
Character Limit | Text fields (single, multi and markdown) allow you to additionally limit the character input count between a given range. |
Limit Input Range | Integers and Floats allow you restrict the allowed numeric range for the fields (always inclusive) to an input between a given range. |
Patterns | Text fields can be restricted by either disallowed text patterns or enforced text patterns. These are defined by standard Regular Expressions (RegExp) and do not need to be wrapped in opening or closing slashes. You can modify these pattern searches with additional flags such as ignoring case, enabling multi-line search, single-line search or both. |
Common patterns
URLs
(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)
Phone
^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$
^([a-z0-9_\.\+-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$
Slug
^[a-z0-9]+(?:-[a-z0-9]+)*$
Create a field validation
- Either add a new field to a model in the schema editor or click "edit field" on an existing field.
- Navigate to the second tab called "validations".
- Enable one of the following validations.mdx
Remove a field validation
- Navigate to the validation tab of your field settings.
- Change the validation you'd like to remove by unchecking the boolean next to the type of validation.