Validation rules are rules that specifies the type of validation tests to perform on a form input.
With octavalidate, you can display a custom error message when a validation test fails.
According to issue #1 on GitHub, we have decided to replace colons on the custom message attribute with a hyphen.
Here, you can find all validation rules that must be entered within the
octavalidate
attribute, as well as the attribute for a custom message.
| Rule Title | Description | Custom message attribute |
|---|---|---|
| R | Required | ov-required-msg |
| ov-email-msg | ||
| ALPHA_ONLY | Letters Only | ov-alpha-only-msg |
| ALPHA_SPACES | Letters and Spaces | ov-alpha-spaces-msg |
| ALPHA_NUMERIC | Letters with Numbers | ov-alpha-numeric-msg |
| LOWER ALPHA | Lowercase letters | ov-lower-alpha-msg |
| UPPER_ALPHA | Uppercase letters | ov-upper-alpha-msg |
| DIGITS | Numbers or Digits | ov-digits-msg |
| PWD | Password | ov-pwd-msg |
| URL | URL | ov-url-msg |
| URL_QP | URL with Query Parameters | ov-url-qp-msg |
| DATE_MDY | Date in the format MM/DD/YYYY | ov-date-mdy-msg |
| USERNAME | Username | ov-username-msg |
| TEXT | General Text | ov-text-msg |
You can use the R validation rule to
validate all input types, but not
including reset, hidden and submit.
The TEXT validation rule supports these special
characters
(. , / () [] & ! '' "" : ; ?) and this means that any character outside the supported
set will be counted as invalid!
Learn more