jquery.AreYouSure
jquery.AreYouSure copied to clipboard
How to disable plugin on form submit?
Hello! I want to see the warning message only when I close the window or leave page, but not on the form submit.
So how can I disable the warning message on form submit?
There is already a code for this purpose inside the plugin. But if you use ajax for submit, you need to remove dirty class from the form(s) or you need to unbind beforeunload handler.
$form.submit(function() {
$form.removeClass(settings.dirtyClass);
});
This issue is actually because you are replacing the form
element in your code, jquery are you sure still thinks its tracking the form but the assigned events are lost.
This bug seems to crop up after validation errors or such. You must add code similar to the following to fix this issue.
$(document).ajaxComplete(function(){
$("form").submit(function(){
$(this).removeClass('dirty');
});
});
We should find a way to integrate this code into the library so users dont have to do this themselves.