Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [webmaster33] Dynamic checkbox list....

Quote Reply
Re: [webmaster33] Dynamic checkbox list.... In reply to
Nice one... thats where I was going wrong!

Finally managed to get it working right with;

field_checkbox_form =>
Code:
sub {
my $column = $_[0];
my $selected = $_[1];
my $table = $DB->table("Users");
my %hash;
my $i = 0;
my $names = $table->form_names->{$column};
my $vals = sort $table->form_values->{$column};
for my $val (@$vals) {
$hash{$val} = $names->[$i++];
}

my $html = $DB->html($table, $IN);
my $form = $html->checkbox({
name => "$column",
values => \%hash,
multiple => 1,
value => $selected });
return $form;
}

..and called with;

<%field_checkbox_form('Field_In_Question',$Field_In_Question)%>

Anyone who uses this.. .enjoy :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Dynamic checkbox list.... Andy 2390 Mar 16, 2005, 1:27 AM
Thread Re: [Andy] Dynamic checkbox list....
webmaster33 2325 Mar 16, 2005, 2:56 AM
Post Re: [webmaster33] Dynamic checkbox list....
Andy 2295 Mar 16, 2005, 5:33 AM