VALIDATION RULES

Validation rules are rules that specifies the type of tests to perform on a form input.

With octavalidate, you can display a custom error message when a validation test fails.

On the table below, you can find all validation rules that can be used within the octavalidate attribute. You will also be able to see the attribute for a custom error message.

Rule Title Description Custom message attribute
R Required ov-required-msg
EMAIL Email 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!

Can't see a rule that you need for your form? Use the custom rule api to build your own validation rule.
Learn more
DEMO FORM

Here's a demo form utilising some of the validation rules above and a custom error message.

<!-- username -->
<input id="inp_uname" type="text" octavalidate="R,USERNAME" ov-username-msg="This username is invalid">
<!-- email -->
<input id="inp_email" type="email" octavalidate="R,EMAIL" ov-email-msg="This email address is invalid">
<!-- description -->
<textarea id="inp_desc" octavalidate="R,TEXT" ov-text-msg="Your description contains invalid characters"></textarea>
Try to provide characters outside the allowed set of characters (. , / () [] & ! '' "" : ; ?)