Validators¶
To use the validators you have to define in the fiels a data attributed based on the validator name (Example: data-required=”True”).
Core validators¶
-
type()¶ The value of the field must fit the data-type.
Arguments: - data-type (string) – Type of validator
-
email¶ The field value must be an email.
-
url¶ The field value must be an url.
-
urlstrict¶ The field value must be an url (must have the protocol defined).
-
digits¶ The field value must be a digit.
-
dateIso¶ The field value must be a date in iso format.
-
alphanum¶ The field value must be a alphanumeric value.
-
phone¶ The field value must be a US phone number.
-
notnull()¶ The field must have a value.
Arguments: - data-notnull (boolean) –
-
notblank()¶ The field must have a not blank (spaces, tabs...) value.
Arguments: - data-notblank (boolean) –
-
required()¶ The field must have a value.
Arguments: - data-required (boolean) –
-
regexp()¶ The field value must match the data-regexp.
Arguments: - data-regexp (string) – Regular expresion to verify
-
min()¶ The field value must be greater than data-min.
Arguments: - data-min (number) – Min value
-
max()¶ The field value must be smaller than data-max.
Arguments: - data-max (number) – Max value
-
range()¶ The field value must be between data-range[0] and data-range[1].
Arguments: - data-range (list) – List of [min, max]
-
minlength()¶ The field value must be longer than data-minlength.
Arguments: - data-minlength (integer) – Min length
-
maxlength()¶ The field value must be shorter than data-maxlength.
Arguments: - data-maxlength (integer) – Max length
-
rangelength()¶ The field value must have a length between data-rangelength[0] and data-rangelength[1].
Arguments: - data-rangelength (list) – List of [minlength, maxlength]
-
equalto()¶
Extend validators¶
-
minwords()¶ The field value must have more than data-minwords words.
Arguments: - data-minwords (integer) – Min words
-
maxwords()¶ The field value must have less than data-maxwords words.
Arguments: - data-maxwords (integer) – Max words
-
rangewords()¶ The field value must have words between data-rangewords[0] and data-rangewords[1].
Arguments: - data-rangewords (list) – List of [minwords, maxwords]
-
greaterthanvalue()¶ The field value must be greater than the value of data-greaterthan.
Arguments: - data-greaterthan (selector) – Min value.
-
lessthanvalue()¶ The field value must be smaller than the value of data-lessthan.
Arguments: - data-lessthan (selector) – Max value.
-
beforedatevalue()¶ The field value must date be a date before the date in data-beforedate.
Arguments: - data-beforedate (selector) – Max date.
-
afterdatevalue()¶ The field value must date be a date after the date in data-afterdate.
Arguments: - data-afterdate (selector) – Min date.
-
greaterthan()¶ The field value must be greater than the field selected by data-greaterthan.
Arguments: - data-greaterthan (selector) – A jquery selector of other field.
-
lessthan()¶ The field value must be smaller than the field selected by data-lessthan.
Arguments: - data-lessthan (selector) – A jquery selector of other field.
-
beforedate()¶ The field value must date be a date before the field selected by data-beforedate.
Arguments: - data-beforedate (selector) – A jquery selector of other field.
-
afterdate()¶ The field value must date be a date after the field selected by data-afterdate.
Arguments: - data-afterdate (selector) – A jquery selector of other field.
-
inlist()¶ The field value must be in the list of valid values.
Arguments: - data-inlist (string) – List of valid values
- data-inlistDelimiter (string) – Delimiter to split the data-inlist string in valid values.
-
luhn()¶ The field value must pass the luhn algorithm (Validates credit card numbers, as well as some other kinds of account numbers).
Arguments: - data-luhn (boolean) –
-
americandate()¶ The field value must be a valid american date.
Arguments: - data-americandate (boolean) –
L10N validators¶
ES¶
-
es_dni()¶ The field value must be a valid Spanish DNI.
Arguments: - data-es_dni (boolean) –
-
es_cif()¶ The field value must be a valid Spanish CIF.
Arguments: - data-es_cif (boolean) –
-
es_postalcode()¶ The field value must be a valid Spanish postal code.
Arguments: - data-es_postalcode (boolean) –
-
es_ssn()¶ The field value must be a valid Spanish social security number.
Arguments: - data-es_ssn (boolean) –
-
es_ccc()¶ The field value must be a valid Spanish bank account number (Codigo Cuenta Cliente).
Arguments: - data-es_ccc (boolean) –