diff options
| author | ivan <ivan> | 2005-09-10 14:50:57 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2005-09-10 14:50:57 +0000 |
| commit | 9e342300c380e29af1b9678f1a9604609e0061b6 (patch) | |
| tree | 72d0edb8de70b19465264c76669045b0ba202e6e /httemplate/misc | |
| parent | 3502e0627909ea99683d1724adb0d4a3fee578b2 (diff) | |
ajax-style xmlhttprequest state/county/country selector!
Diffstat (limited to 'httemplate/misc')
| -rw-r--r-- | httemplate/misc/counties.cgi | 17 | ||||
| -rw-r--r-- | httemplate/misc/states.cgi | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/httemplate/misc/counties.cgi b/httemplate/misc/counties.cgi new file mode 100644 index 000000000..80ae616c9 --- /dev/null +++ b/httemplate/misc/counties.cgi @@ -0,0 +1,17 @@ +<% + + my( $state, $country ) = $cgi->param('arg'); + + my @counties = + sort + map { s/[\n\r]//g; $_; } + map { $_->county; } + qsearch( 'cust_main_county', + { 'state' => $state, + 'country' => $country, + }, + ) + ; + + +%>[ <%= join(', ', map { qq("$_") } @counties) %> ] diff --git a/httemplate/misc/states.cgi b/httemplate/misc/states.cgi new file mode 100644 index 000000000..cff2c9774 --- /dev/null +++ b/httemplate/misc/states.cgi @@ -0,0 +1,16 @@ +<% + + my $country = $cgi->param('arg'); + + my @states = + sort + map { s/[\n\r]//g; $_; } + map { $_->state; } + qsearch( 'cust_main_county', + { 'country' => $country }, + 'DISTINCT ON ( state ) *', + ) + ; + + +%>[ <%= join(', ', map { qq("$_") } @states) %> ] |
