Skip to content

Commit 802ecd9

Browse files
IRS-184: Stop calling the fees api if the fees field and membership id is not present to avoid multiple calls
1 parent 7534709 commit 802ecd9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

js/webform_civicrm_forms.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,12 @@ var wfCivi = (function ($, D) {
452452

453453
// Function to update fee field with AJAX call.
454454
function updateFeeField(membershipId, feeFieldInput) {
455-
if (!membershipId || feeFieldInput.length === 0) {
456-
return;
455+
if (!membershipId || membershipId == null) {
456+
throw new Error('membershipId not found.');
457+
}
458+
if ($(feeFieldInput).length === 0) {
459+
throw new Error('membership-fee-amount-from-membership not found.');
457460
}
458-
459461
$.ajax({
460462
url: '/webform-civicrm/js/getMembershipFees/' + membershipId,
461463
dataType: 'json',

0 commit comments

Comments
 (0)