• I’m trying to prevent users from double clicking submit and sending multiple submissions. I’ve read several suggestions that are supposed to disable the submit button after its clicked, but all are years old.

    Does anyone know how to accomplish this using the latest version of CF7 and WP? What code do I need and where do I put it?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    I solved that problem changing the loading icon for a bigger one to let the people know that there is a pending submition. Download the plugin called “Contact Form 7 Custom Spinner” and try it.

    You could do this:

    Git Hub Gist

    Thread Starter krashx6

    (@krashx6)

    @thehowarde
    Whats the best way to use that code? Could I just put it in between <script></script> on the contact form page? Or does it need to be in a .js file?

    UPDATE 1: I tried adding the code block below on the page above the contact form, but it did not work.

    UPDATE 2: Maybe it did work? It allows me several clicks still, but only 1 email comes through. Should the button be graying out?

    <script>
    jQuery(document).on('click', '.wpcf7-submit', function(e){
         if( jQuery('.ajax-loader').hasClass('is-active') ) {
              e.preventDefault();
              return false;
         }
    });
    </script>
    
    • This reply was modified 5 years, 6 months ago by krashx6.
    • This reply was modified 5 years, 6 months ago by krashx6.
    • This reply was modified 5 years, 6 months ago by krashx6.
    • This reply was modified 5 years, 6 months ago by krashx6.

    Hi @krashx6 if you want to gray out the button, you should add a line in the jquery script between the preventDefault and return false to

    $('.css-class-of-button').prop('disabled', true);

    Thread Starter krashx6

    (@krashx6)

    @thehowarde Thanks bud! I’ll give it a try tonight and report back.

    You’ve been a tremendous help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Prevent double submissions?’ is closed to new replies.