Configurations
The config object
{
container: 'form', // [string (css selector)]
button: null, // [null, string (css selector)]
validationBy: 'onsubmit', // [onclick, onsubmit]
novalidateHTML5: true, // [true, false]
validateOnFieldChanges: true, // [true, false]
showListOfValidations: true, // [true, false]
selectors: {...},
messages: {...},
customValidationsConfig: {...},
callbacks: {...},
customValidates: {...},
asyncValidates: {...},
customViewErrors: {...},
customListErrors: {...},
onContainerSuccess: null, // [null, Function]
onFormSubmit: null // [null, Function]
};
Key | Type | Default | Description |
---|---|---|---|
container | string |
form | Css selector of form or fields container. |
button | null or string |
null | Css selector of button that will validate the container. If null, will get a button or an input of type submit by default. If not is a button or an input of type submit, you must define |
validationBy | string [onclick, onsubmit] |
onsubmit | Sets how the validator will be call. 'onsubmit' only if container is a form element. |
novalidateHTML5 | boolean |
true | enables or disables html5 validations. |
validateOnFieldChanges | boolean |
true | Enables or disables validations on field changes. |
showListOfValidations | boolean |
true | If true will show list of all errors. That errors will appear on element that have class configured in selectors.wrapErrors. |
selectors | Object |
{...} | A object with selectors used by validator. See more in selectors section. |
messages | Object |
{...} | A object with messages erros shown by validator. See more in messages section. |
customValidationsConfig | Object |
{...} | A object with configurations to set custom validations behavior. See more in custom validations behavior section. |
callbacks | Object |
{...} | A object with custom callbacks methods. See more in callback section. |
customValidates | Object |
{...} | A object with your own custom validations. See more in custom validations section. |
asyncValidates | Object |
{...} | A object with your own custom async validators. See more in async validators section. |
customViewErrors | Object |
{...} | A object with an add and remove keys. Here you can customize your view errors. See more in custom view errors section. |
customListErrors | Object |
{...} | A object with an add and remove keys. Here you can customize your view list all errors. See more in custom view list errors section. |
onContainerSuccess | Funciton |
null | A function that will be called when your validation is successful. If your container is not a form element this configuration is required. See more in container successful section. |
onFormSubmit | Function |
null | A function that will be called when your validation is successfull. Called only if the container is a form element. If not defined, the default behavior is a |