From: Andrew Hunt Date: Fri, 12 Apr 2013 04:03:24 +0000 (-0400) Subject: Store and reinstate valid state/county when copying X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fddb38589de3aa554a34a7fde9be924ee948b865;p=civicrm-core.git Store and reinstate valid state/county when copying --- diff --git a/templates/CRM/common/stateCountry.tpl b/templates/CRM/common/stateCountry.tpl index 54ad3bfe47..3cbe1558c5 100644 --- a/templates/CRM/common/stateCountry.tpl +++ b/templates/CRM/common/stateCountry.tpl @@ -43,7 +43,21 @@ callbackURL = {/literal}"{crmURL p='civicrm/ajax/jqState' h=0}"{literal} - cj( '#' + countryID ).chainSelect( '#' + stateProvinceID, callbackURL, null ); + cj( '#' + countryID ).chainSelect( + '#' + stateProvinceID, + callbackURL, + { + before : function (target) { + if (typeof(setdefault) === "undefined") { setdefault = new Array(); } + targetid = cj(target).attr("id"); + eval('setdefault[targetid] = cj(target).val()'); + }, + after : function(target) { + targetid = cj(target).attr("id"); + cj(target).val(setdefault[targetid]); + } + } + ); }); {/literal} {/if} @@ -63,7 +77,19 @@ callbackURL = {/literal}"{crmURL p='civicrm/ajax/jqCounty' h=0}"{literal} - cj( '#' + stateProvinceID ).chainSelect( '#' + countyID, callbackURL, null ); + cj( '#' + stateProvinceID ).chainSelect( '#' + countyID, callbackURL, + { + before : function (target) { + if (typeof(setdefault) === "undefined") { setdefault = new Array(); } + targetid = cj(target).attr("id"); + eval('setdefault[targetid] = cj(target).val()'); + }, + after : function(target) { + targetid = cj(target).attr("id"); + cj(target).val(setdefault[targetid]); + } + } + ); }); {/literal} {/if}