DefaultSubmit plugin

Submit the form if all fields are valid after validating

Usage

The following piece of code is the starting point to use the DefaultSubmit plugin:




    


    
...
document.addEventListener('DOMContentLoaded', function(e) { FormValidation.formValidation( document.getElementById('demoForm'), { fields: { ... }, plugins: { defaultSubmit: new FormValidation.plugins.DefaultSubmit(), ... }, } ); });

The sample code above assumes that the FormValidation files are placed inside the vendors directory. You might need to change the path depending on where you place them on the server.

Instead of submitting the form, you can use an Ajax request to send the form data to the server.

Tip

If you want the form to be validated automatically when pressing its Submit button, use the SubmitButton plugin