X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-table.html;h=a52fdfaaa505692ac8a0b5ffd22668eafeca0d59;hp=6c8089b31de180b3ea38167e2751a765ca4c5041;hb=d2b55d07a9e6e64a38877136d7974ab93e14f1ed;hpb=c0e8da2f1e89729efa1032241e4239765a296514 diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 6c8089b31..a52fdfaaa 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -1,59 +1,233 @@ -<% - - ##required - # 'table' => 'table_name', - # 'name_col' => 'name_column', - # - ##strongly recommended (you want your forms to be "sticky" on errors, right?) - # 'value' => 'current_value', - # - ##opt - # 'empty_label' => '', #better specify it though, the default might change - # 'hashref' => {}, - # 'extra_sql' => '', - # 'records' => \@records, #instead of hashref - # 'pre_options' => [ 'value' => 'option' ], #before normal options - - my( %opt ) = @_; - - #warn "***** select-table: \n". Dumper(%opt); - - my $key = dbdef->table($opt{'table'})->primary_key; #? $opt{'primary_key'} || - - my $name_col = $opt{'name_col'}; - - my @records = (); - if ( $opt{'records'} ) { - @records = @{ $opt{'records'} }; - } else { - @records = qsearch( { - 'table' => $opt{'table'}, - 'hashref' => ( $opt{'hashref'} || {} ), - 'extra_sql' => ( $opt{'extra_sql'} || '' ), - }); - } - - my @pre_options = $opt{'pre_options'} ? @{ $opt{'pre_options'} } : (); - -%> - - + 'pre_options' => [ 'value' => 'option' ], #before normal options + 'post_options' => [ 'value' => 'option' ], #after normal options + 'empty_label' => '', #better specify it though, the default might change + 'multiple' => 0, # bool + 'all_selected' => 0, # useful with multiple + 'disable_empty' => 0, # bool (implied by multiple) + 'label_showkey' => 0, # bool + 'label_callback' => sub { my $record = shift; return "label"; }, + + #more params controlling HTML stuff about the element + 'onchange' => '', #javascript code + + #params (well, a param) controlling the