Advertisement
chrishajer

Disable submit button after submit and change text

Jan 23rd, 2013
2,760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement