From 26398922267c585d20fffa22ab1292d0c9399eee Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Oct 2015 13:52:37 -0600 Subject: [PATCH] CRM-17469 - add javascript to update pledge contribution amount when pledge amount checkboxes change --- templates/CRM/Contribute/Form/Contribution/Main.tpl | 11 +++++++++++ 1 file changed, 11 insertions(+) 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} -- 2.25.1