PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to prevent double form submission on submit?

  1. Title says it all really - GF working great - but can't prevent a form submitting twice if a user double clicks on the submit button. User then thinks they've been locked out; one of the fields only allows unique entries: and theirs is "always taken".

    Normally I would drop a bit of Javascript in the form (as below )

    onsubmit="document.getElementById('emailFormSubmit').disabled=true;document.getElementById('emailFormSubmit').value='Submitting, please wait...'

    but no idea if it's possible to hook into he plugin to do this.

    I've just tried three or jQuery solutions and none of them are working...

    Any ideas out there?

    Posted 13 years ago on Monday May 31, 2010 | Permalink
  2. You can attach code to the submit button using the gform_submit_button hook.

    See this page for information on this hook, it's the last one on the page:

    http://www.gravityhelp.com/documentation/hooks-and-filters/

    Posted 13 years ago on Monday May 31, 2010 | Permalink
  3. Que? .... A-hah!

    Drop that code into the theme's functions.php... I can see where this is going now..

    Many thanks

    Gabriel

    Posted 13 years ago on Monday May 31, 2010 | Permalink