Skip to content

Field Validators

The validators that constrain what may be saved in a field.

Validators is an array, so a field may carry several. Each one constrains the stored value and accepts a Message shown when it fails. Validators run only on a value that is present - requiring a value is what IsRequired does.

Which validators suit which types is recorded on each validator.
Type Summary
alphanumeric The value must contain only letters and digits.
decimal The value must be a decimal number.
different The value must differ from the value of another named field of the same type.
email The value must be a valid email address.
eq The value must equal a given value.
gt The value must be greater than a given value or another field's value.
gte The value must be greater than or equal to a given value or another field's value.
lt The value must be less than a given value or another field's value.
lte The value must be less than or equal to a given value or another field's value.
maxitems The field must hold at most a given number of entries.
maxlength The value must be at most a given number of characters.
maxsize An uploaded file must be no larger than a given number of bytes.
minitems The field must hold at least a given number of entries.
not The value must not equal a given value.
number The value must be a whole number.
phone The value must be a valid phone number.
regex The value must match a regular expression.
same The value must equal the value of another named field of the same type.
url The value must be a valid URL.