RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / elements / select-table.html
index a52fdfa..ecac7f7 100644 (file)
@@ -83,13 +83,14 @@ Example:
 %                   || ( $value eq $pre_opt );
     <OPTION VALUE="<% $pre_opt %>"
             <% $selected ? 'SELECTED' : '' %>
-    ><% $pre_label %>
+    ><% $pre_label %></OPTION>
 % } 
 
 % unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
-    <OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
+    <OPTION VALUE=""><% $opt{'empty_label'} || 'all' %></OPTION>
 % }
 
+% my $curr_option_found;
 % foreach my $record ( 
 % # we have the order_by parameter for this
 % #sort {    $a->$name_col() cmp $b->$name_col()
@@ -108,6 +109,7 @@ Example:
 %     $selected =    ( ref($value) && $value->{$recvalue} )
 %                 || ( $value && $value eq $recvalue ); #not == because of value_col
 %   }
+%   $curr_option_found = $selected unless $curr_option_found;
     <OPTION VALUE="<% $recvalue %>"
             <% $selected ? ' SELECTED' : '' %>
 %           foreach my $att ( @{ $opt{'extra_option_attributes'} } ) {
@@ -118,7 +120,7 @@ Example:
           ? &{ $opt{'label_callback'} }( $record )
           : $record->$name_col()
         |h
-     %>
+     %></OPTION>
 % } 
 
 % while ( @post_options ) { 
@@ -128,7 +130,12 @@ Example:
 %                  || ( $value eq $post_opt );
     <OPTION VALUE="<% $post_opt %>"
             <% $selected ? 'SELECTED' : '' %>
-    ><% $post_label %>
+    ><% $post_label %></OPTION>
+% }
+
+% my $non_option_label = $opt{'non_option_label'};
+% if (!$curr_option_found && $non_option_label && $value) {
+    <OPTION VALUE="<% $value %>" SELECTED><% $non_option_label %></OPTION>
 % } 
 
 </SELECT>