Guarding the form
Since version 1.3.0, you can specify your guards via data attributes
alone. This will use any named guards that exist (including custom
named guards). Currently, grouped guards
oneRequired) are not supported. On your form,
specify it to be guarded by adding the
attribute to enable guards, or the
attribute to enable live guards.
You can specify multiple guards delimited by spaces, and you can
provide arguments to those guards. Arguments that are not of a
single options object form are not supported (such as passing an
allow or a regex for
However, as of version 1.3.1, all built in named guards that
required something other than a single options object now support an
object form as well.
Further customizing the guard
The data attributes also supports changing the message of a specific
type of named guard. Simply add
data-guard-<type>-message to either the parent
form or the element itself. The
<type> is the
name of the guard (such as
int). If specified on the form, it overrides the
message for that named guard on any applicable element of that form.
If specified on the element, it only applies to that element (and it
will override any message specified at the form level).