get DIDs from globalpops
[freeside.git] / httemplate / elements / select-state.html
diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html
new file mode 100644 (file)
index 0000000..4f1c056
--- /dev/null
@@ -0,0 +1,24 @@
+<SELECT NAME="<% $opt{'prefix'} %>state" onChange="<% $opt{'prefix'} %>state_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+
+% if ($opt{empty}) {
+  <OPTION VALUE=""<% $opt{state} eq '' ? ' SELECTED' : '' %>><% $opt{empty} %>
+% }
+
+% foreach my $state ( keys %states ) { 
+
+  <OPTION VALUE="<% $state %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %>
+
+% } 
+
+
+</SELECT>
+
+<%init>
+my %opt = @_;
+foreach my $opt (qw( county state country prefix onchange disabled empty )) {
+  $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
+}
+
+tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); 
+</%init>
+