CRM-16809 - Hide contribution submit buttons for paypal express
authorColeman Watts <coleman@civicrm.org>
Tue, 11 Aug 2015 14:29:06 +0000 (10:29 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 11 Aug 2015 14:40:02 +0000 (10:40 -0400)
templates/CRM/Financial/Form/PaypalExpress.tpl
templates/CRM/common/paymentBlock.tpl

index dc1510d73bc4f0ec2adebdee5a7e734af483b8d2..1f8f4853bbf0b83b2a03d3a7ff437f90e7b8a79e 100644 (file)
       </div>
     </fieldset>
   </div>
+{literal}
+  <script type="text/javascript">
+    CRM.$(function($) {
+      var $form = $('#billing-payment-block').closest('form');
+      $('.crm-submit-buttons', $form).hide();
+    });
+  </script>
+{/literal}
index 7ee0301ed332ed5e96b8a46781a4c420a06f1f8e..b46276c2db62b95532ed30098dc921e1372b8eed 100644 (file)
@@ -28,6 +28,8 @@
 
   CRM.$(function($) {
     function buildPaymentBlock(type) {
+      var $form = $('#billing-payment-block').closest('form');
+
       {/literal}{if !$isBillingAddressRequiredForPayLater}{literal}
       if (type == 0) {
         $("#billing-payment-block").html('');
@@ -49,6 +51,9 @@
       var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="`$urlPathVar``$contributionPageID`processor_id="}" + type;
 
       {literal}
+      // Processors like pp-express will hide the form submit buttons, so re-show them when switching
+      $('.crm-submit-buttons', $form).show().find('input').prop('disabled', true);
+
       CRM.loadPage(dataUrl, {target: '#billing-payment-block'});
     }
   
@@ -56,6 +61,9 @@
     $('[name=payment_processor_id]').on('change.paymentBlock', function() {
         buildPaymentBlock($(this).val());
     });
+    $('#billing-payment-block').on('crmLoad', function() {
+      $('.crm-submit-buttons input').prop('disabled', false);
+    })
   });
 
 </script>