Support » Plugin: Contact Form 7 » 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 (http://epsiloncool.ru/programmirovanie/preventing-multiple-submits-in-contact-form-7 and https://wordpress.org/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");
        }
      }); 
      
    });
Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    You don’t have to submit multiple times. Just don’t do it.

    Thanks for your answer. Unfortunattely, I can not control the behavior of stupid users, that expect immediate answer after pushing send buttom… while ajax is doing its work, they submit again and again… Since the submit is considered an important event in my Analytics, I have all statistics changed… So, the only way I found was to prevent the event after first push…

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    You can’t control, but you can remove obstacles for users. What do you think makes users submit more than once? Don’t you think there may be problems in your site design or it might take too much time completing a submission?

    @asoaresfil Gracias! Thanks for your solution. It seems to work very well from what I’ve tested.

    & thank you Takayuki for your excellent work on this plugin. I had a similar issue: dealing with impatient users that continue clicking “submit” while photos are uploading. Unfortunately even adding messages and trying to improve the UI/design of the form still resulted in multiple emails coming through.

    I too have issues with users pressing submit button multiple times. The form isn’t slow, has 3 image upload fields so takes a second or two to load.

    Drives me mad when I see inbox with up to 8 duplicates where the user is imagined he’s playing Counter Strike!

    So what was the solution for this(multiple email notifications/every submission)? I’m not seeing it. Thanks.

    Dear @takayukister thanks for your great work with CF7. I´m using your plugin on almost all of our websites.

    Unfortunately I´m facing the same problems as @asoaresfil on different websites, even without file upload form fields. The server and the UI is not the reason for that multi-submissions.

    It is really annoying as we are also working on some sites with big Google AdWords campaigns. And this multiple submissions are breaking our Adwords / Analytics statistics and also making our customers angry.

    So I agree it would be a very good feature in CF7. What do you think @takayukister?

    Thanks
    Steffen

    Any solutions to this? Also having an issue with impatient users pressing submit multuple times.

    An update on my post from yesterday:

    – Good news: It seems the statistics (AdWords / Google Analytics) are not getting broken by this multiple submissions –

    – Bad news: It is getting weird with the mutliple sent out emails. Recently I had a submission of one person where I received 25 mails (!). I don´t think that this user hit 25 times the submit button. What I can see, that most of our form submits coming from mobile devices. Maybe could it has something todo with an unstable internet connection?

    However this case is getting critical as my customer think we are not able to perform a propoer working contact form 🙁

    This thread by the way is not resolved – how can we re-open it? Or do we have to start a new thread?

    Thanks
    Steffen

    P.S.: I have opened a new support thread https://wordpress.org/support/topic/multiple-submissions-many-emails-sent-out-for-one-form-submit/

    Thanks, Alcides, for posting your javascript snippet. Hope there’s a solution within the plugin soon!

    Hello,

    You can try this javascript snippet:

    
    // Prevent multiple submissions with Contact Form 7
    jQuery(document).on('click', '.wpcf7-submit', function(e){
        if( jQuery(this).siblings('.ajax-loader').hasClass('is-active') ) {
    	e.preventDefault();
    	return false;
        }
    }); 
    

    Regards,
    Raúl.

    • This reply was modified 1 year, 8 months ago by  raulvelasco.

    @raulvelasco Your snippet worked for me. Thank you!

    Raúl, where should we add your snippet? Which is the right file? functions.php?

    @cclimente include a custom js file, put that snippet inside a jQuery(document).ready(function(){}), enqueue that script via functions.php.

    unfortunately, @raulvelasco this snippet isn’t working for me, though.

    anyone else have any ideas? this is so perplexing.

    Yep. Doesn’t work for me either 🙁

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Multiple submissions when click submit many times’ is closed to new replies.