registerValidator() method
Register a validator
It is used when you want to use a custom validator.
registerValidator(name: String, func: Function): Core
(* denotes a required parameter)
Parameter | Type | Description |
---|
name * | String | The name of validator |
func * | Function | The validator function |
Using the global script in the browser
const fv = FormValidation.formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.registerValidator(...);
Using the ES6 module
import { formValidation } from '/path/to/@form-validation/cjs/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.registerValidator(...);
Using the npm package
import { formValidation } from '@form-validation/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.registerValidator(...);
See also