When auto-renew option is available, show the checkbox immediately instead of upon...
authorPatrick Lam <prof.lam@gmail.com>
Tue, 16 Jan 2024 11:03:44 +0000 (00:03 +1300)
committereileen <emcnaughton@wikimedia.org>
Sat, 27 Jan 2024 23:09:01 +0000 (12:09 +1300)
memTypeId was previously "undefined" after trying to read attribute
"membership-type".  The DOM shows an attribute
"data-membership-type-id" and this patch modifies the attribute read
to "data-membership-type-id", which is also consistent with the
variable name in the code.

templates/CRM/Contribute/Form/Contribution/MainMembershipBlock.tpl

index c4aca6522042f35a366ee11e6a5cc8cba82e2021..ecad3a4821d47cdf4ef10d1937224f42316ef973 100644 (file)
       var priceSetName = "price_"+{/literal}'{$membershipFieldID}'{literal};
       var considerUserInput = {/literal}'{$takeUserSubmittedAutoRenew}'{literal};
       if ( memTypeId ) considerUserInput = false;
-      if ( !memTypeId ) memTypeId = cj('input:radio[name='+priceSetName+']:checked').attr('membership-type');
+      if ( !memTypeId ) memTypeId = cj('input:radio[name='+priceSetName+']:checked').data('membership-type-id');
 
       //does this page has only one membership type.
       var renewOptions  = {/literal}{$autoRenewMembershipTypeOptions}{literal};