Supported Rules
required
boolean
required fields will be given a unique class you can use to mark the field as required. E.g:
.VF-Field--required label {
position: relative;
}
.VF-Field--required>label:before {
content:"*";
font-size: 20px;
color:red;
position: absolute;
left:-15px;
}
requiredIf
string
- make the field required only if another field was filled with a value (typically a select or checkbox). The field would only display when required. To set specific values for requiring the field use the following format:{ field: { requiredIf:'otherField:val1, val2' } }
requiredAndShownIf
string
- same asrequiredIf
, except that the field is also hidden when it is not required.email
boolean
- Automatically set totrue
forvf-email
number
boolean
- Automatically set totrue
forvf-number
min
,max
,between
number
-a. If the
number
orinteger
rules are set totrue
validates numeric valuesb. If the parameter is a
moment
object or aYYYY-MM-DD
-formatted string validates datesc. Otherwise - validates string length
integer
boolean
digits
boolean
remote
string
Validate field on the server end. Accepts a URL, to which the value is sent on change event as a request parameter. Requiresvue-resource
greaterThan
,smallerThan
string
accepts the name of the compared field. Compares numbers and datesurl
boolean
matches
string
The field under validation must match the specified field. The classic usage is password confirmation.