Working with Field Validations

Field validations allow you to control the accepted input of a field.

Validation typesAnchor

TypeDescription
RequiredA value must be present.
UniqueNo other entry may have an identical value defined for that field.
Character LimitText fields (single, multi and markdown) allow you to additionally limit the character input count between a given range.
Limit Input RangeIntegers and Floats allow you restrict the allowed numeric range for the fields (always inclusive) to an input between a given range.
PatternsText 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 patternsAnchor

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+))?$

Email

^([a-z0-9_\.\+-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$

Slug

^[a-z0-9]+(?:-[a-z0-9]+)*$

Create a validationAnchor

  1. Either add a new field to a model in the schema editor or click "edit field" on an existing field.
  2. Navigate to the second tab called "validations".
  3. Enable one of the following validations.mdx

Remove a validationAnchor

  1. Navigate to the validation tab of your field settings.
  2. Change the validation you'd like to remove by unchecking the boolean next to the type of validation.

Did you find this page useful?

Your feedback helps us improve our docs, and product.