Events
A collection of events that you can hook on
After initializing the form with FormValidation.formValidation(), you can listen to events provided by formValidation or its plugins.
Using the global script in the browser
<script src="/vendors/@form-validation/umd/bundle/popular.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(e) {
const fv = FormValidation.formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.on(EVENT_NAME, function(event) {
...
});
});
</script>
Using the ES6 module
import { formValidation } from '/path/to/@form-validation/cjs/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.on(EVENT_NAME, function(event) {
...
});
Using the npm package
- Install the bundle package:
$ npm install @form-validation/bundle
- Use the
formValidation instance:
import { formValidation } from '@form-validation/bundle/popular';
const fv = formValidation(
document.getElementById('demoForm'),
{
...
}
);
fv.on(EVENT_NAME, function(event) {
...
});
The next sections list all of the events provided by the library.