X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust_location.html;h=abaaa5b42dbeb306ca2812a2f0db2d169eca1751;hb=7d26901e658bd61078f10c0713676f94375f3283;hp=d9e3e9e27a3bc164760bb9af6da09915f9d2469b;hpb=dda70549e974d4b559f9d5a117948b931813c7d1;p=freeside.git diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index d9e3e9e27..abaaa5b42 100644 --- a/httemplate/elements/tr-select-cust_location.html +++ b/httemplate/elements/tr-select-cust_location.html @@ -31,6 +31,9 @@ Example: else what.form.<%$_%>.value = ''; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#dddddd'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = true; + } } function location_clear(what) { @@ -38,6 +41,9 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype == 'INPUT' ) what.form.<%$_%>.value = ''; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.value = ''; + } % if ( $opt{'alt_format'} ) { changeSelect(what.form.location_kind, ''); changeSelect(what.form.location_type, ''); @@ -51,11 +57,15 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#ffffff'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = false; + } % if ( $opt{'alt_format'} ) { - if ( what.form.location_type.options[what.form.location_type.selectedIndex].value ) { + if ( what.form.location_type && + what.form.location_type.options[what.form.location_type.selectedIndex].value ) { what.form.location_number.disabled = false; what.form.location_number.style.backgroundColor = '#ffffff'; - } + } % } } @@ -152,25 +162,16 @@ Example: } } + var location_fields = <% encode_json(\@location_fields) %>; function update_location( string ) { - var hash = eval('('+string+')'); - document.getElementById('address1').value = hash['address1']; - document.getElementById('city').value = hash['city']; - document.getElementById('zip').value = hash['zip']; - -% if ( $opt{'alt_format'} ) { - changeSelect( document.getElementById('location_kind'), hash['location_kind']); - changeSelect( document.getElementById('location_type'), hash['location_type']); - document.getElementById('location_number').value = hash['location_number']; -% } else { - document.getElementById('address2').value = hash['address2']; -% } - - var country_el = document.getElementById('country'); - - changeSelect( country_el, hash['country'] ); - - country_changed( country_el, + var hash = JSON.parse(string); + for(var i = 0; i < location_fields.length; i++) { + var f = location_fields[i]; + if (hash[f] && document.getElementById(f)) { + document.getElementById(f).value = hash[f]; + } + } + country_changed( document.getElementById('country'), fix_state_factory( hash['state'], hash['county'] ) @@ -184,7 +185,7 @@ Example: