SHARE
TWEET

Disable submit button after submit and change text

chrishajer Jan 23rd, 2013 1,570 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // Snippet to change 'Submit' button to 'Processing...' and disable it
  3. // Change the 116 here to your form ID
  4. add_filter('gform_pre_render_116', 'disable_submit');
  5. function disable_submit($form) {
  6.     ?>
  7.    
  8.     <script type="text/javascript">
  9.     jQuery(document).ready(function($){
  10.         $('#gform_submit_button_<?php echo $form['id']; ?>').on('click', function(event){
  11.            
  12.             var submitCopy = $(this).clone();
  13.             submitCopy.prop('id', '').prop('disabled', true).prop('value', 'Processing...').insertAfter($(this));
  14.            
  15.             $(this).hide();
  16.            
  17.         });
  18.     });
  19.     </script>
  20.    
  21.     <?php
  22.     return $form;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top