Update the passport form to disable the submit button
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 5 Jun 2018 18:13:20 +0000 (14:13 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 5 Jun 2018 18:13:20 +0000 (14:13 -0400)
When submitting the form disable the button to prevent double send.

Toolkit/Contacts/PassPort.php
js/PassportForm.js

index 2d5ec06..cfdfa4e 100755 (executable)
@@ -1,6 +1,6 @@
 <?php
 //    vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
-$GLOBALS['bottomScripts'][] = MEDIA_BASE_URL . 'js/PassportForm.js?v=1.0.0';
+$GLOBALS['bottomScripts'][] = MEDIA_BASE_URL . 'js/PassportForm.js?v=1.0.1';
 /**
  * File Doc Comment
  *
index 9d6751e..cadbd67 100644 (file)
@@ -32,4 +32,13 @@ $(document).ready(function () {
     PassportForm.pass_type = pass_type_selected.val();
     PassportForm.qty = qty.val();
     setPassportPrice();
+
+    // Disable the submit button after the first click it to
+    // Prevent double sending the form
+    $('#contact_form').submit(function(e){
+        // Disable the submit button
+        $('input[name="submit_rmv"]').attr('disabled', true);
+        $('input[name="submit_rmv"]').val('Processing...please Wait!');
+        return;
+    });
 });