summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_main/select-state.html
blob: 98e685ab86e04d10a7b44a0a3b2604aa76c56f2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<%

  my %opt = @_;
  foreach my $opt (qw( county state country prefix onchange disabled )) {
    $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
  }

%>

<SELECT NAME="<%= $opt{'prefix'} %>state" onChange="<%= $opt{'prefix'} %>state_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>

<% foreach my $state (
     sort
     map { $_->state }
     qsearch( 'cust_main_county',
              { 'country' => $opt{'country'} },
              'DISTINCT ON ( state ) *',
            )
   ) {
%>

  <OPTION VALUE="<%= $state %>"<%= $state eq $opt{'state'} ? ' SELECTED' : '' %>><%= $state || '(n/a)' %>

<% } %>

</SELECT>