♻️ changes the way to prevent double form submission

Instead of disabling form submit buttons, which values were lost
in the process, attach a new handler which disabled form submission
until first submission is processed
This commit is contained in:
Jean-Louis Jouannic 2022-07-13 16:44:42 +02:00 committed by Christopher Charbonneau Wells
parent dd016cb1ea
commit e6107b6f3d
1 changed files with 6 additions and 2 deletions

View File

@ -75,6 +75,10 @@ BabyBuddy.PullToRefresh = function(ptr) {
/**
* Fix for duplicate form submission from double pressing submit
*/
function preventDoubleSubmit() {
return false;
}
$('form').off("submit", preventDoubleSubmit);
$("form").on("submit", function() {
$(this).find("button[type='submit']").prop('disabled', true);
});
$(this).on("submit", preventDoubleSubmit);
});