From: ivan Date: Wed, 27 Dec 2006 01:07:28 +0000 (+0000) Subject: fix county selector X-Git-Tag: TRIXBOX_2_6~810 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=8e95986bf97e83e00b0375dd1517c4bd0afb23e5 fix county selector --- diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index e2ed0f1da..896472d2b 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -204,17 +204,19 @@ function bill_changed(what) { what.form.ship_<%$_%>.value = what.form.<%$_%>.value; % } - what.form.ship_country.selectedIndex = what.form.country.selectedIndex; + + function fix_ship_county() { + what.form.ship_county.selectedIndex = what.form.county.selectedIndex; + } + function fix_ship_state() { what.form.ship_state.selectedIndex = what.form.state.selectedIndex; + ship_state_changed(what.form.ship_state, fix_ship_county ); } + ship_country_changed(what.form.ship_country, fix_ship_state ); - function fix_ship_county() { - what.form.ship_county.selectedIndex = what.form.county.selectedIndex; - } - ship_state_changed(what.form.ship_state, fix_ship_county ); } } function samechanged(what) { @@ -242,7 +244,7 @@ function samechanged(what) { % my $disabledselect = ''; % unless ( $cust_main->ship_last && $same ne 'Y' ) { % $checked = 'CHECKED'; -% $disabled = 'DISABLED style="background-color: #dddddd"'; +% $disabled = 'DISABLED STYLE="background-color: #dddddd"'; % foreach ( % qw( last first company address1 address2 city county state zip country % daytime night fax ) diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html index c9b64bf4f..5b068214e 100644 --- a/httemplate/edit/cust_main/select-county.html +++ b/httemplate/edit/cust_main/select-county.html @@ -16,8 +16,8 @@ function <% $opt{'prefix'} %>state_changed(what, callback) { - state = what.options[what.selectedIndex].text; - country = what.form.<% $opt{'prefix'} %>country.options[what.form.<% $opt{'prefix'} %>country.selectedIndex].text; + state = what.options[what.selectedIndex].value; + country = what.form.<% $opt{'prefix'} %>country.options[what.form.<% $opt{'prefix'} %>country.selectedIndex].value; function <% $opt{'prefix'} %>update_counties(counties) { @@ -34,6 +34,12 @@ opt(what.form.<% $opt{'prefix'} %>county, countiesArray[s], countyLabel); } + if ( countiesArray.length > 1 ) { + what.form.<% $opt{'prefix'} %>county.style.display = ''; + } else { + what.form.<% $opt{'prefix'} %>county.style.display = 'none'; + } + //run the callback if ( callback != null ) callback(); @@ -47,14 +53,8 @@