Each validator takes the message to show and returns a rule for validate. The rule returns the message when the value is invalid, and null when it is fine.
Submit the empty form to see every message.
| Validator | Fails when |
|---|---|
isNotEmpty(message) | empty string, empty list, false, null or undefined |
isEmail(message) | the value is not an email |
matches(regex, message) | the value is not a string that matches the pattern |
hasLength(length, message) | the length is out of n or of { min, max } |
isInRange({ min, max }, message) | the value is not a number inside the range |
matchesField(path, message) | the value differs from the field at path |
Strings are trimmed before isNotEmpty and hasLength check them.