Selectors
The selectors config
selectors: { // just css classes
control: 'vv-control',
required: 'required',
email: 'email',
integer: 'integer',
digit: 'digit',
numeric: 'numeric',
pattern: 'pattern',
phone: 'phone', // brazilian format
url: 'url',
date: 'date', // brazilian format
currency: 'currency', // brazilian format
cep: 'cep', // brazilian format
maxLength: 'max-length',
minLength: 'min-length',
rangeLength: 'range-length',
sameLength: 'same-length',
max: 'max',
min: 'min',
range: 'range',
equalTo: 'equal-to',
cpf: 'cpf', // brazilian document
cnpj: 'cnpj', // brazilian document
cnh: 'cnh', // brazilian document
creditCard: 'credit-card',
hasExtension: 'has-extension',
customValidate: 'custom-validate',
async: 'async',
asyncWaiting: 'vv-async-waiting',
error: 'error',
formError: 'form-error',
messageError: 'msg-error',
wrapErrors: 'wrap-errors'
}
Key | Value | Default | Description |
---|---|---|---|
control | string | vv-control | Class that will be add in all form elements. |
required | string | required | Class to make field required. No field will be required without this class. |
string | Class to validate the field's value as a email. |
||
integer | string | integer | Class to validate the field's value as a integer. |
digit | string | digit | Class to validate the field's value as a digit. |
numeric | string | numeric | Class to validate the field's value as a number. |
pattern | string | pattern | Class to test the field's value with given pattern. The pattern must be given by the html attribute 'data-pattern' or by the 'customValidationsConfig.pattern'. |
phone | string | phone | Class to validate the field's value as a phone number. Is used the brazilian format here. |
url | string | url | Class to validate the field's value as a url. |
date | string | date | Class to validate the field's value as a date. |
currency | string | currency | Class to validate the field's value as a currency format. Is used the brazilian format here. |
cep | string | cep | Class to validate the field's value as a postal code format. Is used the brazilian format here. |
maxLength | string | max-length | Class to validate the field's value with max length limit. The max length must be given by the html attribute 'data-max-length' or by the 'customValidationsConfig.maxLength'. |
minLength | string | min-length | Class to validate the field's value with min length limit. The min length must be given by the html attribute 'data-min-length' or by the 'customValidationsConfig.minLength'. |
rangeLength | string | range-length | Class to validate the field's value with min and max length limit. The min and max length must be given by the html attribute 'data-min-length' and 'data-max-length' respectively, or by the 'customValidationsConfig.rangeLength' object in keys 'min' and 'max' respectively. |
sameLength | string | same-length | Class to validate the field's value with exact length. The length must be given by the html attribute 'data-same-length' or by the 'customValidationsConfig.sameLength'. |
max | string | max | Class to validate the field's value with max value number. The max value must be given by the html attribute 'data-max' or by the 'customValidationsConfig.max'. |
min | string | min | Class to validate the field's value with min value number. The min value must be given by the html attribute 'data-min' or by the 'customValidationsConfig.min'. |
range | string | range | Class to validate the field's value with min and max value number. The min and max value must be given by the html attribute 'data-min' and 'data-max' respectively, or by the 'customValidationsConfig.range' object in keys 'min' and 'max' respectively. |
equalTo | string | equal-to | Class to validate the field's value with exact value number. The value must be given by the html attribute 'data-equal-to' or by the 'customValidationsConfig.equalTo'. |
cpf | string | cpf | Class to validate the field's value as a cpf format. It's a brazilian document. |
cnpj | string | cnpj | Class to validate the field's value as a cnpj format. It's a brazilian document. |
cnh | string | cnh | Class to validate the field's value as a cnh format. It's a brazilian document. |
creditCard | string | credit-card | Class to validate the field's value as a credit card number. |
hasExtension | string | has-extension | Class to check if the field has a valid file extension. The valid extensions must be given by the html attribute 'data-extensions' or by the 'customValidationsConfig.extensions'. |
customValidate | string | custom-validate | Class to apply a custom validation on field. The custom validation must be created in 'customValidates' object and must be given by the html attribute 'data-validate-key'. See more in custom validations section. |
async | string | async | Class to apply a custom async validation on field. The custom async validation must be created in 'asyncValidates' object and must be given by the html attribute 'data-async-key'. See more in async validators section. |
asyncWaiting | string | vv-async-waiting | Class applied in view feedback of async validation. This view will be shown while the async validation is being made. |
error | string | error | Class applied in a field that has an error. |
formError | string | form-error | Class applied in a container that has an error. |
messageError | string | msg-error | Class applied in a field's view feedback error. |
wrapErrors | string | wrap-errors | Class of the container that list all errors. |