addField() method

Add a field
addField(field: String, options: Object): Core
(* denotes a required parameter)
ParameterTypeDescription
field*StringThe field name
optionsObjectThe field options. The options will be merged with the original validator rules if the field is already defined
Using the global script in the browser
const fv = FormValidation.formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.addField(...);
Using the ES6 module
import { formValidation } from '/path/to/@form-validation/cjs/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.addField(...);
Using the npm package
import { formValidation } from '@form-validation/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.addField(...);

See also