I want to stop duplicate WFFM form submissions. I am writing a method to disable the button after first submission.
$("form").each(function() {
var wffm = $(this).attr("data-wffm");
if (wffm) {
console.log($(this));
var submitButton = $("input[type=submit]", $(this));
submitButton.click(function(e) {
var checkFormValidity = $(this).parents('form').valid();
if (checkFormValidity) {
submitButton.prop('disabled', true);
}
}
});
The above code disables the button after first submission but it is also not allowing the page to redirect to the Thankyou page.
Am I missing anything?
How to disable the button after first click and also allow the page to redirect to the Thankyou page.
This is not a duplicate question. I don’t want to solve this issue inside wffm.js script. I have written a new script to resolve this issue.