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.

Disable / Deactivate Submit Button on Submission

  1. wordpressuser
    Member

    I did look at all the suggested / similar topics... but I can't seem to find the answer. I really did try!

    Is it possible to deactivate / disable the submit button when a form is submitted? I have an order form that takes a bit long to complete, and I am really worried about double submission.

    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  2. Richard Vav
    Administrator

    You could try something like this replacing the 2 with your form number

    $('#gform_submit_button_2').click(function(){
    	$('#gform_submit_button_2').attr("disabled", true);
    });
    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  3. Thanks Richard. Here is another, more verbose way of doing the same thing: http://pastebin.com/TR1Lu7Tb

    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  4. Chris:
    If I remove the 116, it will apply to all my forms, right?

    And I reckon, it should go into functions.php?

    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  5. Yes, if you remove the 116, it will apply to all forms. And yes, functions.php in your current theme. All PHP normally goes into your theme's functions.php.

    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  6. It works. Thank you, Chris.

    Posted 6 years ago on Thursday February 14, 2013 | Permalink
  7. wordpressuser
    Member

    This seems to work.

    Is there any sort of weird side effect to this that would cause wp-admin to not be accessible if implemented incorrectly?

    Posted 6 years ago on Saturday February 16, 2013 | Permalink
  8. wordpressuser
    Member

    Pasting the code at http://pastebin.com/TR1Lu7Tb in my theme > functions.php page under the area indicated below caused my admin backend to act erratically...?

    /*-----------------------------------------------------------------------------------*/
    /* End WooThemes Functions - You can add custom functions below */
    /*-----------------------------------------------------------------------------------*/

    ?>

    Posted 6 years ago on Saturday February 16, 2013 | Permalink
  9. This code should not have any effect at all on your admin, since it will be run only when form 116 is being rendered on the front end.

    Posted 6 years ago on Monday February 18, 2013 | Permalink