Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / elements / select-county.html
index aa9f453..058993f 100644 (file)
@@ -2,7 +2,7 @@
 
 Example:
 
 include( '/elements/select-county.html',
<& /elements/select-county.html,
     #recommended
     country    => $current_country,
     state      => $current_state,
@@ -15,7 +15,7 @@ Example:
     disable_empty => 1, #defaults to 1, disable the empty option
     empty_label   => 'all', #label for empty option
     style         => [ 'attribute:value', 'another:value' ],
-  );
+  &>
 
 </%doc>
 % if ( $countyflag ) { 
@@ -136,7 +136,7 @@ my $onchange =
   ( $opt{'disable_cityupdate'} ? '' : $pre.'county_changed(this); ' ).
   $opt{'onchange'};
 
-$opt{'style'} ||= [];
+my $county_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
 
 my @counties = ();
 if ( $countyflag ) {
@@ -144,14 +144,14 @@ if ( $countyflag ) {
   @counties = map { length($_) ? $_ : $opt{'empty_data_value'} }
                   counties( $opt{'state'}, $opt{'country'} );
 
-  push @{ $opt{'style'} }, 'display:none'
+  push @$county_style, 'display:none'
     unless scalar(@counties) > 1;
 
 }
 
 my $style =
-  scalar(@{$opt{style}})
-    ? 'STYLE="'. join(';', @{$opt{style}}). '"'
+  scalar(@$county_style)
+    ? 'STYLE="'. join(';', @$county_style). '"'
     : '';
 
 </%init>