From c31d8ebb3db44b1fb3995a1f7d64cb8116429087 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 2 May 2014 15:39:39 -0700 Subject: [PATCH] Contribution onBehalf form - Fix js bug --- .../Form/Contribution/OnBehalfOf.tpl | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index a3661bcea9..cc4d771128 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -164,22 +164,9 @@ function showOnBehalf(onBehalfRequired) { } } -function resetValues( filter ) { - if (filter) { - cj("#select_org div").find( 'input[type=text], select, textarea' ).each(function( ) { - if ( cj(this).attr('name') != 'onbehalf[organization_name]' ) { - cj(this).val(''); - } - }); - } - else { - cj("#select_org div").find( 'input[type=text], select, textarea' ).each(function( ) { - cj(this).val( '' ); - }); - } - cj("#select_org tr td").find( 'input[type=radio], input[type=checkbox]' ).each(function( ) { - cj(this).attr('checked', false); - }); +function resetValues() { + cj('input[type=text], select, textarea', "#select_org div").not('#onbehalfof_id').val(''); + cj('input[type=radio], input[type=checkbox]', "#select_org tr td").prop('checked', false); } function createNew( ) { @@ -187,7 +174,7 @@ function createNew( ) { var textMessage = ' {/literal}{ts escape="js"}Use existing organization{/ts}{literal} '; cj("#onbehalf_organization_name").removeAttr('readonly'); cj("#mode").removeAttr('checked'); - resetValues( false ); + resetValues(); } else { var textMessage = ' {/literal}{ts escape="js"}Enter a new organization{/ts}{literal} '; @@ -207,7 +194,7 @@ function setOrgName( ) { function setLocationDetails(contactID) { - resetValues(true); + resetValues(); var locationUrl = {/literal}"{$locDataURL}"{literal} + contactID + "&ufId=" + {/literal}"{$profileId}"{literal}; cj.ajax({ url : locationUrl, @@ -277,7 +264,7 @@ function selectCreateOrg( orgOption, reset ) { } if ( reset ) { - resetValues( false ); + resetValues(); } } -- 2.25.1