5 include( '/elements/select-state.html',
7 country => $current_country,
8 state => $current_state,
11 prefix => $optional_unique_prefix,
12 onchange => $javascript,
14 disable_empty => 1, #defaults to 1, disable the empty option
15 empty_label => 'all', #label for empty option
16 disable_countyupdate => 0, #bool - disabled update of the select-state.html
21 <SELECT NAME = "<% $pre %>state"
22 ID = "<% $pre %>state"
23 onChange = "<% $onchange %>"
26 % unless ( $opt{'disable_empty'} ) {
27 <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty_label} %>
30 % foreach my $state ( keys %states ) {
32 <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
42 foreach my $opt (qw( state country prefix onchange disabled empty_label )) {
43 $opt{$opt} = '' unless exists($opt{$opt}) && defined($opt{$opt});
46 $opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'});
48 my $pre = $opt{'prefix'};
51 ( $opt{'disable_countyupdate'} ? '' : $pre.'state_changed(this); ' ).
54 tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} );