From f2882c118b8a501ad4d1ed0305ce10271cf8e16a Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 21 Sep 2020 08:03:30 +1000 Subject: [PATCH] dev/core#2030 ensure that the Country selector is a Select 2 and ensure that if it is not shown on the contribution form that it doesn't prevent form submissions --- CRM/Core/Payment.php | 2 +- templates/CRM/common/paymentBlock.tpl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index b312c8e8d9..94bdfd88ec 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -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; } diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index 1d5c3e5e71..c3171f349d 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -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); } -- 2.25.1