4 # 'table' => 'table_name',
5 # 'name_col' => 'name_column',
7 ##strongly recommended (you want your forms to be "sticky" on errors, right?)
8 # 'value' => 'current_value',
11 # 'empty_label' => '', #better specify it though, the default might change
13 # 'records' => \@records, #instead of hashref
17 my $key = dbdef->table($opt{'table'})->primary_key; #? $opt{'primary_key'} ||
19 my $name_col = $opt{'name_col'};
22 if ( $opt{'records'} ) {
23 @records = @{ $opt{'records'} };
25 @records = qsearch( $opt{'table'}, ( $opt{'hashref'} || {} ) );
30 <SELECT NAME="<%= $key %>">
32 <OPTION VALUE=""><%= $opt{'empty_label'} || 'all' %></OPTION>
34 <% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() }
40 <OPTION VALUE="<%= $record->$key() %>"<%= $opt{'value'} == $record->$key() ? ' SELECTED' : '' %>><%= $record->$name_col() %>