summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-state.html
diff options
context:
space:
mode:
authorivan <ivan>2008-12-28 18:48:51 +0000
committerivan <ivan>2008-12-28 18:48:51 +0000
commitd8cb6cd67cc574c90dbbfbd8db2da6711c516d65 (patch)
treea1635fa18b7ccca84e53599fc2bb05233c08317c /httemplate/elements/select-state.html
parenta96ddd777a87c2f74a9cf408b44d0f6e7347b5f3 (diff)
fix browse results for selecting counties (resulting from separating tax classes), also add dropdowns to browse by state and county, RT#4496
Diffstat (limited to 'httemplate/elements/select-state.html')
-rw-r--r--httemplate/elements/select-state.html45
1 files changed, 39 insertions, 6 deletions
diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html
index 4f1c056b5..f7ac2c7bf 100644
--- a/httemplate/elements/select-state.html
+++ b/httemplate/elements/select-state.html
@@ -1,12 +1,35 @@
-<SELECT NAME="<% $opt{'prefix'} %>state" onChange="<% $opt{'prefix'} %>state_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+<%doc>
-% if ($opt{empty}) {
- <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty} %>
+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
+ );
+
+</%doc>
+
+<SELECT NAME = "<% $pre %>state"
+ ID = "<% $pre %>state"
+ onChange = "<% $onchange %>"
+>
+
+% unless ( $opt{'disable_empty'} ) {
+ <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty_label} %>
% }
% foreach my $state ( keys %states ) {
- <OPTION VALUE="<% $state %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
+ <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
% }
@@ -14,11 +37,21 @@
</SELECT>
<%init>
+
my %opt = @_;
-foreach my $opt (qw( county state country prefix onchange disabled empty )) {
- $opt{$_} = '' unless exists($opt{$_}) && defined($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'} );
+
</%init>