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.

Disabling the Submit button to prevent multiple entries

  1. We have long forms on http://www.insurancehero.ca, and when the user hits submit, it takes a few seconds to load the next screen. Some users have been clicking submit again, and again, and again until it bogs down the full process on the server.

    Is there anyway to disable the submit button after it is clicked once to prevent this?

    Posted 11 years ago on Friday June 1, 2012 | Permalink
  2. David Peralty

    There isn't currently a built-in way to disable submit. You can make one of the form fields set-up to be no duplicates. This would stop any duplicate data from being submitted.

    You could also limit entries by IP: http://gravitywiz.com/2012/05/12/limit-ip-to-one-submission-per-time-period/

    You could also find some JavaScript that would disable the form submit button on click. Which you can then use this documentation to help you integrate it:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Posted 11 years ago on Friday June 1, 2012 | Permalink
  3. Hey dkeezer,

    I am having the same issue. Did you ever find a solution?

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  4. You can do this with jQuery.

    jQuery(document).ready(function() {
    		jQuery('#gform_59 input[type=submit]', this).click(function() {
    			jQuery('#gform_59 input[type=submit]').css('display','none');
    		});
    	});

    Just replace the "59: with the correct ID of your form. Upon clicking, this will hide the submit button.

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  5. Chaddahlberg
    Member

    Thanks for posting this Rob. However - can you clarify what file this code should be put in? I know the Form ID needs to change - just not sure what file this should be put in.

    Posted 11 years ago on Wednesday September 12, 2012 | Permalink
  6. Sure thing, see this page for some helpful tips on code placement:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Posted 11 years ago on Wednesday September 12, 2012 | Permalink
  7. How do I change it so it works for all forms and not just one?

    And I just inserted it for one form and tested. The submit button dissapeares but the form doesn't submit anything?

    Posted 11 years ago on Sunday September 23, 2012 | Permalink
  8. This code has both the disabled button as well as explanatory text, which is very nice. How do I convert this into Gravity Forms, so it affects all my buttons?

    http://www.mkyong.com/jquery/how-to-disable-submit-button-after-clicked-with-jquery/

    Posted 11 years ago on Sunday September 23, 2012 | Permalink
  9. What code did you add to your site already? The gform_enqueue_scripts filter can be used to load your custom script on every page which utilizes a Gravity Form:

    http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts

    Once you get the code working, you can enqueue it with this filter and it should be added to every page where there is a Gravity Form.

    Posted 11 years ago on Monday September 24, 2012 | Permalink
  10. Nice solution, but one problem.

    somehow firefox and chrome detect my email field and display its not a valid email after pressing submit.

    so the button hides and the form is not submitted so my users have a form without a submit button!

    see image: http://s10.postimage.org/z6zwxidx1/Schermafbeelding_2012_11_28_om_15_03_54.png?noCache=1354111489
    is there a way to shut down this option in firefox chrome etc?

    Posted 11 years ago on Wednesday November 28, 2012 | Permalink
  11. Can you post a link to your form please?

    Posted 11 years ago on Saturday December 1, 2012 | Permalink