5 include( '/elements/checkboxes-table-name.html',
10 'link_table' => 'table_name',
12 'name_col' => 'name_column',
14 'name_callback' => sub { },
16 'names_list' => [ 'value',
18 [ 'complex value' => { 'desc' => "Add'l description",
25 # recommended (required?)
29 #'source_table' => 'table_name',
30 #'sourcenum' => '4', #current value of primary key in source_table
31 # # (none is okay, just pass it if you have it)
36 'num_col' => 'col_name' #if column name is different in link_table than
38 'link_static' => { 'column' => 'value' },
44 <% include('checkboxes.html',
45 'names_list' => $opt{'names_list'},
46 'checked_callback' => $checked_callback,
47 'element_name_prefix' => $opt{'link_table'}. '.',
55 my @pset = ( 'a'..'z', 'A'..'Z', '0'..'9' );
57 my $prefix = $opt{prefix}
58 || join('', map $pset[ int(rand $#pset) ], (0..20) );
60 my( $source_pkey, $sourcenum, $source_obj );
61 if ( $opt{'source_obj'} ) {
63 $source_obj = $opt{'source_obj'};
64 #$source_table = $source_obj->dbdef_table->table;
65 $source_pkey = $source_obj->dbdef_table->primary_key;
66 $sourcenum = $source_obj->$source_pkey();
71 $source_pkey = $opt{'source_table'}
72 ? dbdef->table($opt{'source_table'})->primary_key
74 $sourcenum = $opt{'sourcenum'};
77 $source_pkey = $opt{'num_col'} || $source_pkey;
79 my $link_static = $opt{'link_static'} || {};
81 my $checked_callback = sub {
82 my( $cgi, $name ) = @_;
83 qsearchs( $opt{'link_table'}, {
84 $source_pkey => $sourcenum,
85 $opt{'name_col'} => $name,