From: Mathieu Lutfy Date: Tue, 27 Sep 2016 15:21:27 +0000 (-0400) Subject: CRM-17991: Fix Safari JS bug in COntribution popups (affects softcredits, pledges). X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4a3ed8390725cd28e29f6ae227704f2c48e96745;p=civicrm-core.git CRM-17991: Fix Safari JS bug in COntribution popups (affects softcredits, pledges). --- diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 4d509a865d..78462bdaeb 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -470,12 +470,6 @@ } } } - - function status() { - cj("#cancel_date").val(''); - cj("#cancel_reason").val(''); - } - {/literal} @@ -502,26 +496,26 @@ {/literal}{if !$contributionMode}{literal} CRM.$(function($) { - showHideCancelInfo(cj('#contribution_status_id')); + showHideCancelInfo($('#contribution_status_id')); + + $('#contribution_status_id').change(function() { + showHideCancelInfo($('#contribution_status_id')); + }); - cj('#contribution_status_id').change(function() { - showHideCancelInfo(cj('#contribution_status_id')); + function showHideCancelInfo(obj) { + var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}]; + if (cancelInfo_show_ids.indexOf(obj.val()) > -1) { + $('#cancelInfo').show( ); + $('#total_amount').attr('readonly', true); + } + else { + $("#cancel_date").val(''); + $("#cancel_reason").val(''); + $('#cancelInfo').hide( ); + $("#total_amount").removeAttr('readonly'); + } } - ); - }); - - function showHideCancelInfo(obj) { - var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}]; - if (cancelInfo_show_ids.indexOf(obj.val()) > -1) { - cj('#cancelInfo').show( ); - cj('#total_amount').attr('readonly', true); - } - else { - status(); - cj('#cancelInfo').hide( ); - cj("#total_amount").removeAttr('readonly'); - } - } + }); {/literal}{/if}{literal}