Hi
,
Is this for CHECKBOX or RADIO ?
If its for CHECKBOX, should be able to use something like this: (untested!)
my @current_val_split = split /\n/, $_[0];
my $vals;
foreach (@current_val_split) { $vals->{$_} = 1 }
for (my $i = 0; $i <= 250; $i++) {
my $tmp;
if (!$field_vals->{form_values}[$i]) { last }
$tmp->{value} = $field_vals->{form_values}[$i];
$tmp->{name} = $field_vals->{form_names}[$i];
if ($vals->{$tmp->{name}}) { $tmp->{selected} = 1; }
push @checkbox_loop, $tmp;
}
return { checkbox_loop => \@checkbox_loop }
}
Then, call with:
<ul>
<%loop checkbox_loop%>
<li value="<%value%>" <%if selected%>selected="yes"<%endif%>><%name%></li>
<%endloop%>
</ul>
Hope that helps.
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!
,
Is this for CHECKBOX or RADIO ?
If its for CHECKBOX, should be able to use something like this: (untested!)
Code:
sub { my @current_val_split = split /\n/, $_[0];
my $vals;
foreach (@current_val_split) { $vals->{$_} = 1 }
for (my $i = 0; $i <= 250; $i++) {
my $tmp;
if (!$field_vals->{form_values}[$i]) { last }
$tmp->{value} = $field_vals->{form_values}[$i];
$tmp->{name} = $field_vals->{form_names}[$i];
if ($vals->{$tmp->{name}}) { $tmp->{selected} = 1; }
push @checkbox_loop, $tmp;
}
return { checkbox_loop => \@checkbox_loop }
}
Then, call with:
Code:
<%global_name($Checkbox_field_name)%> <ul>
<%loop checkbox_loop%>
<li value="<%value%>" <%if selected%>selected="yes"<%endif%>><%name%></li>
<%endloop%>
</ul>
Hope that helps.
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!