validate
Validates the whole form (every input, textarea, select, radio,
checkbox, and file field) without submitting it.
Returns: Promise<false \| ErrorMessageInterface>
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
userOptions | FormConstructorInterface | optional | - | Overrides the form/customErrorMessages configured on this instance. |
callback | object | optional | - | Optional callback invoked with the validation result. |
Usage
Option 1.
const myForm = document.getElementById("myForm")
nfsfu234FormValidation.validate(form)
.then((response) => {
const { message, type, data } = response;
console.log(response);
});Option 2.
const myForm = document.getElementById("myForm");
nfsfu234FormValidation.validate(myForm, (response) => {
const { message, type, data } = response;
console.log(response);
});Last updated on