X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust_location.html;h=47a917dbdeb07bb7be9addecdab471427ce02d0a;hb=51e2a2439d923d63a5a2321864c69f82272cd362;hp=b804f4548bfd96864359d3aa4d52b521332da32b;hpb=33aa032478e29000c8c0d4fbe7bf8cb25c277606;p=freeside.git diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index b804f4548..47a917dbd 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'] ) @@ -182,30 +183,14 @@ Example: <<%$th%> ALIGN="right"><% $opt{'label'} || emt('Service location') %>> - + + <& /elements/select-cust_location.html, + %opt, + 'curr_value' => $locationnum, + 'cust_location' => \@cust_location, + 'onchange' => 'locationnum_changed(this);', + &> + @@ -217,6 +202,7 @@ Example: 'no_bold' => $opt{'no_bold'}, 'alt_format' => $opt{'alt_format'}, 'enable_coords'=> 1, + 'enable_censustract' => 1, ) %>