From 929f432c766bbe3bdeed5b80818a12ddf6ec6339 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Apr 2006 09:46:57 +0000 Subject: have the UI use full country names, and state names outside the US... --- httemplate/edit/cust_main/contact.html | 2 +- httemplate/edit/cust_main/select-country.html | 11 ++++++----- httemplate/edit/cust_main/select-state.html | 13 +++---------- httemplate/misc/states.cgi | 14 ++------------ httemplate/view/cust_main/contacts.html | 4 ++-- 5 files changed, 14 insertions(+), 30 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index e0cd06f56..6e4f08957 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -96,7 +96,7 @@ my $r = qq!* !; <%=$r%>Country - <%= include('select-country.html', %select_hash ) %> + <%= include('select-country.html', %select_hash ) %> diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html index 014effd66..3941f2f93 100644 --- a/httemplate/edit/cust_main/select-country.html +++ b/httemplate/edit/cust_main/select-country.html @@ -26,7 +26,7 @@ function <%= $opt{'prefix'} %>country_changed(what, callback) { - country = what.options[what.selectedIndex].text; + country = what.options[what.selectedIndex].value; function <%= $opt{'prefix'} %>update_states(states) { @@ -36,8 +36,8 @@ // add the new states var statesArray = eval('(' + states + ')' ); - for ( var s = 0; s < statesArray.length; s++ ) { - var stateLabel = statesArray[s]; + for ( var s = 0; s < statesArray.length; s=s+2 ) { + var stateLabel = statesArray[s+1]; if ( stateLabel == "" ) stateLabel = '(n/a)'; opt(what.form.<%= $opt{'prefix'} %>state, statesArray[s], stateLabel); @@ -58,13 +58,14 @@ > -<% foreach my $state ( - sort - map { $_->state } - qsearch( 'cust_main_county', - { 'country' => $opt{'country'} }, - 'DISTINCT ON ( state ) *', - ) - ) { -%> +<% tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); %> +<% foreach my $state ( keys %states ) { %> -