From e8783189b8e95a013e7f56c750083832e6c2a198 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 28 Dec 2008 18:48:16 +0000 Subject: fix browse results for selecting counties (resulting from separating tax classes), also add dropdowns to browse by state and county, RT#4496 --- httemplate/elements/select-state.html | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 httemplate/elements/select-state.html (limited to 'httemplate/elements/select-state.html') diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html new file mode 100644 index 000000000..f7ac2c7bf --- /dev/null +++ b/httemplate/elements/select-state.html @@ -0,0 +1,57 @@ +<%doc> + +Example: + + include( '/elements/select-state.html', + #recommended + country => $current_country, + state => $current_state, + + #optional + prefix => $optional_unique_prefix, + onchange => $javascript, + disabled => 0, #bool + disable_empty => 1, #defaults to 1, disable the empty option + empty_label => 'all', #label for empty option + disable_countyupdate => 0, #bool - disabled update of the select-state.html + ); + + + + + +<%init> + +my %opt = @_; +foreach my $opt (qw( state country prefix onchange disabled empty_label )) { + $opt{$opt} = '' unless exists($opt{$opt}) && defined($opt{$opt}); +} + +$opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'}); + +my $pre = $opt{'prefix'}; + +my $onchange = + ( $opt{'disable_countyupdate'} ? '' : $pre.'state_changed(this); ' ). + $opt{'onchange'}; + +tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); + + + -- cgit v1.2.1