CRM-17469 - add javascript to update pledge contribution amount when pledge amount...
authorunknown <Marty Wright@.(none)>
Fri, 30 Oct 2015 19:52:37 +0000 (13:52 -0600)
committerunknown <Marty Wright@.(none)>
Fri, 30 Oct 2015 19:52:37 +0000 (13:52 -0600)
templates/CRM/Contribute/Form/Contribution/Main.tpl

index eca12113c390466ca6d519a22b4abdbbc04bfefc..3a8f617ec4ca3504f1865fd328d9156738aa5953 100644 (file)
 
     $('#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}
 </script>
 {/if}