Skip to content

Commit

Permalink
Merge pull request #17526 from mattwire/frontendrequiredpaymentfrequency
Browse files Browse the repository at this point in the history
Disable frequency/interval fields if not required. Mark required if they are so they are validated before submit
  • Loading branch information
eileenmcnaughton authored Jul 17, 2020
2 parents 7151204 + 2a95981 commit 11fd7e4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion templates/CRM/Contribute/Form/Contribution/Main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,27 @@
var isRecur = cj('input[id="is_recur"]:checked');
var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
var quickConfig = {/literal}{$quickConfig}{literal};
if ( allowAutoRenew && cj("#auto_renew") && quickConfig) {
if (allowAutoRenew && cj("#auto_renew") && quickConfig) {
showHideAutoRenew(null);
}

var frequencyUnit = cj('#frequency_unit');
var frequencyInerval = cj('#frequency_interval');
var installments = cj('#installments');
isDisabled = false;

if (isRecur.val() > 0) {
cj('#recurHelp').show();
frequencyUnit.prop('disabled', false).addClass('required');
frequencyInerval.prop('disabled', false).addClass('required');
installments.prop('disabled', false);
cj('#amount_sum_label').text('{/literal}{ts escape='js'}Regular amount{/ts}{literal}');
}
else {
cj('#recurHelp').hide();
frequencyUnit.prop('disabled', true).removeClass('required');
frequencyInerval.prop('disabled', true).removeClass('required');
installments.prop('disabled', true);
cj('#amount_sum_label').text('{/literal}{ts escape='js'}Total Amount{/ts}{literal}');
}
}
Expand Down

0 comments on commit 11fd7e4

Please sign in to comment.