From 458a839580874b461d31372a2948c12711b10a9d Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Fri, 9 May 2014 15:27:16 -0700 Subject: [PATCH] CRM-13981 - Refactor enableHonorType function to use newer style. ---------------------------------------- * CRM-13981: https://issues.civicrm.org/jira/browse/CRM-13981 --- .../CRM/Contribute/Form/Contribution/Main.tpl | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 0f496931a1..48bcf53b20 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -340,10 +340,6 @@ {elseif $onBehalfRequired} showOnBehalf(true); {/if} - - {if $honor_block_is_active AND $form.soft_credit_type_id.html} - enableHonorType(); - {/if} {literal} cj('input[name="soft_credit_type_id"]').on('change', function() { @@ -351,21 +347,12 @@ }); function enableHonorType( ) { - var element = document.getElementsByName("soft_credit_type_id"); - for (var i = 0; i < element.length; i++ ) { - var isHonor = false; - if ( element[i].checked == true ) { - var isHonor = true; - break; - } - } - if ( isHonor ) { + var selectedValue = cj('input[name="soft_credit_type_id"]:checked'); + if ( selectedValue.val() > 0) { cj('#honorType').show(); - cj('#honorTypeEmail').show(); } else { cj('#honorType').hide(); - cj('#honorTypeEmail').hide(); } } @@ -423,6 +410,7 @@ CRM.$(function($) { toggleConfirmButton(); + enableHonorType(); }); function showHidePayPalExpressOption() { -- 2.25.1