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)
ParameterTypeDescription
name*StringThe name of validator
func*FunctionThe 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