Multiple submissions when click submit many times
-
When a submit any form in Contact Form 7, clicking more than on time (while ajax is working for send email, feed screen etc.), i get sucessive submits. Since I send e-mails for feeding back the writer and my client, they receive many sucessive e-mails.
I had to put in all pages a rotine for disable submit onclick. It seens to be working well, but I think that this wold be implemented inside the pluguin (otherwise, you will have to inject the code in all pages using a pluguin like Simple Custom CSS and JS). The advantage I see is that you dont have to intall an injector pluguin and also to have this code in all pages.
Since I am not a programmer, may be the community can improve the below code. All recent solutions I′ve googled on the internet (https://epsiloncool.ru/programmirovanie/preventing-multiple-submits-in-contact-form-7 and https://www.ads-software.com/support/topic/disable-submit-button-while-loading/ ) don′t work with recent versions of COntact Form 7.
Here is the code I am using now:
jQuery(document).ready(function () { console.log("página carregada com preven??o duplo clique!"); jQuery(document).on('click', '.wpcf7-submit', function(e){ if( jQuery('.ajax-loader').hasClass('is-active') ) { e.preventDefault(); jQuery('.wpcf7-form-control.wpcf7-submit.form__button').val('Por favor aguarde ...').attr('disabled', 'disabled'); console.log("Bot?o desabilitado"); return false; } else { jQuery('.wpcf7-form-control.wpcf7-submit.form__button').val('Enviar').removeAttr("disabled"); console.log("Bot?o habilitado"); } }); });
- The topic ‘Multiple submissions when click submit many times’ is closed to new replies.