- function locationnum_changed(what) {
- var locationnum = what.options[what.selectedIndex].value;
- if ( locationnum == -1 ) {
-
-% for (@location_fields) {
- what.form.<%$_%>.disabled = false;
- what.form.<%$_%>.style.backgroundColor = '#ffffff';
-% }
-
- what.form.address1.value = '';
- what.form.address2.value = '';
- what.form.city.value = '';
- what.form.zip.value = '';
- changeSelect(what.form.country, <% $countrydefault |js_string %>);
-%#shouldn't we sleep/wait here until the state dropdown is updated?
-%#(is it even triggered???)
- changeSelect(what.form.state, <% $statedefault |js_string %>);
- what.form.county.selectedIndex = 0;
-
- } else {
-
- if ( locationnum == 0 ) {
- what.form.address1.value = <% $cust_main->address1 |js_string %>;
- what.form.address2.value = <% $cust_main->address2 |js_string %>;
- what.form.city.value = <% $cust_main->city |js_string %>;
- what.form.zip.value = <% $cust_main->zip |js_string %>;
- changeSelect(what.form.country, <% $cust_main->country | js_string %> );
-%#shouldn't we sleep/wait here until the state dropdown is updated?
-%#(is it even triggered???)
- changeSelect(what.form.state, <% $cust_main->state | js_string %> );
-%#shouldn't we sleep/wait here until the county dropdown is updated?
-%#(is it even triggered???)
- changeSelect(what.form.county, <% $cust_main->county | js_string %> );
- } else {
- get_location( locationnum, update_location );
- }
-
-%#sleep/wait until dropdowns are updated?
-% for (@location_fields) {
- what.form.<%$_%>.disabled = true;
- what.form.<%$_%>.style.backgroundColor = '#dddddd';
-% }
-
- }
- }
-
- function changeSelect(what, value) {
- for ( var i=0; i<what.length; i++) {
- if ( what.options[i].value == value ) {
- what.selectedIndex = i;
- }
- }
- }
-
- function update_location( hash ) {
- alert(hash);
- }
-