dev/core#2030 ensure that the Country selector is a Select 2 and ensure that if it...
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 20 Sep 2020 22:03:30 +0000 (08:03 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 20 Sep 2020 22:03:30 +0000 (08:03 +1000)
CRM/Core/Payment.php
templates/CRM/common/paymentBlock.tpl

index b312c8e8d9318fe1d12426f75638cb074bb8c686..94bdfd88ec35af1d0633547d9b6bc16c31ea47be 100644 (file)
@@ -1131,7 +1131,7 @@ abstract class CRM_Core_Payment {
         '' => ts('- select -'),
       ] + CRM_Core_PseudoConstant::country(),
       'is_required' => TRUE,
-      'extra' => ['class' => 'required'],
+      'extra' => ['class' => 'required crm-form-select2 crm-select2'],
     ];
     return $metadata;
   }
index 1d5c3e5e71ac784ff63e2cbc69289afd2794df14..c3171f349d4031f06f2978517852c546d2bf91aa 100644 (file)
@@ -28,6 +28,8 @@
       payment_processor.hide();
       payment_information.hide();
       billing_block.hide();
+      // Ensure that jquery validation doesn't block submission when we don't need to fill in the billing details section
+      cj('#billing-payment-block select.crm-select2').addClass('crm-no-validate');
       // also unset selected payment methods
       cj('input[name="payment_processor_id"]').removeProp('checked');
     }
@@ -36,6 +38,7 @@
       payment_processor.show();
       payment_information.show();
       billing_block.show();
+      cj('#billing-payment-block select.crm-select2').removeClass('crm-no-validate');
       // also set selected payment methods
       cj('input[name="payment_processor_id"][checked=checked]').prop('checked', true);
     }