From: unknown Date: Fri, 30 Oct 2015 19:52:37 +0000 (-0600) Subject: CRM-17469 - add javascript to update pledge contribution amount when pledge amount... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=26398922267c585d20fffa22ab1292d0c9399eee;p=civicrm-core.git CRM-17469 - add javascript to update pledge contribution amount when pledge amount checkboxes change --- diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index eca12113c3..3a8f617ec4 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -454,6 +454,17 @@ $('#pricevalue').each(toggleBillingBlockIfFree).on('change', toggleBillingBlockIfFree); }); + + CRM.$(function($) { + // Update pledge contribution amount when pledge checkboxes change + cj("input[name^='pledge_amount']").on('change', function() { + var total = 0; + cj("input[name^='pledge_amount']:checked").each(function() { + total += Number(cj(this).attr('amount')); + }); + cj("input[name^='price_']").val(total.toFixed(2)); + }); + }); {/literal} {/if}