%doc>
Example:
include( '/elements/city.html',
#recommended
country => $current_country,
state => $current_state,
county => $current_county,
city => $current_city,
#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
style => [ 'attribute:value', 'another:value' ],
);
%doc>
<% include('/elements/xmlhttp.html',
'url' => $p.'misc/cities.cgi',
'subs' => [ $pre. 'get_cities' ],
)
%>
<% $text_style %>
>
%# VALUE = "<% $curr_value |h %>"
<%init>
my %opt = @_;
my $pre = $opt{'prefix'};
my $text_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
my $select_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
my @cities = cities( $opt{'county'}, $opt{'state'}, $opt{'country'} );
my $saved_city = '';
if ( scalar(@cities) > 1 || $cities[0] ) {
push @$text_style, 'display:none';
} else {
push @$select_style, 'display:none';
$saved_city = $opt{'city'};
}
$text_style =
scalar(@$text_style)
? 'STYLE="'. join(';', @$text_style). '"'
: '';
$select_style =
scalar(@$select_style)
? 'STYLE="'. join(';', @$select_style). '"'
: '';
%init>