revalidateField() method
Revalidate a particular field
revalidateField(field: String): Promise
(* denotes a required parameter)
Parameter | Type | Description |
---|
field * | String | The field name |
This method is useful when the field value is effected by third parties (for example, attach another UI library to the field). Since there isn't an automatic way for FormValidation to know when the field value is modified in those cases, we need to revalidate the field manually.
Using the global script in the browser
const fv = FormValidation.formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv
.revalidateField(...)
.then(function(status) {
...
});
Using the ES6 module
import { formValidation } from '/path/to/@form-validation/cjs/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv
.revalidateField(...)
.then(function(status) {
...
});
Using the npm package
import { formValidation } from '@form-validation/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv
.revalidateField(...)
.then(function(status) {
...
});
See also