Nice one... thats where I was going wrong!
Finally managed to get it working right with;
field_checkbox_form =>
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!
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!