CUSTOM packages/actual flag for custom packages #3988
[freeside.git] / httemplate / elements / select-table.html
index 4efbcba..1a440f0 100644 (file)
@@ -64,8 +64,13 @@ Example:
 >
 
 % while ( @pre_options ) { 
-    <OPTION VALUE="<% shift(@pre_options) %>"><% shift(@pre_options) %>
-
+%   my $pre_opt   = shift(@pre_options);
+%   my $pre_label = shift(@pre_options);
+%   my $selected =    ( ref($value) && $value->{$pre_opt} )
+%                  || ( $value eq $pre_opt );
+    <OPTION VALUE="<% $pre_opt %>"
+            <% $selected ? 'SELECTED' : '' %>
+    ><% $pre_label %>
 % } 
 
 % unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
@@ -139,7 +144,7 @@ if ( $opt{'records'} ) {
   });
 }
 
-unless (    ! $value
+unless (    $value < 1 # !$value #ignore negatives too
          or ref($value)
          or ! exists( $opt{hashref}->{disabled} ) #??
          or grep { $value == $_->$key() } @records