jqBootstrapValidation
jqBootstrapValidation copied to clipboard
submitSuccess fires off multiple times if put inside a button
I'm not exactly sure, but I think the submitSuccess fires off multiple times.
$("button").click(function() {
$("input", "#form").jqBootstrapValidation({
submitSuccess: function(booking, e) {
alert("This is an alert");
e.preventDefault();
}
});
});
In that code sample, the alert will go off according to the number of input text having an error.
For example:
- There are three required inputs
- Deliberately miss one and let the validation runs
- When submitting the form, you'll get two alerts (you should get only 1)
Note: preventDefault is there since I am using AJAX to submit the form, and I have multiple forms in a page.