Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [cwschroeder] Global for ENUM-field (checkboxes)

Quote Reply
Re: [cwschroeder] Global for ENUM-field (checkboxes) In reply to
Hi
,
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!
Subject Author Views Date
Thread Global for ENUM-field (checkboxes) calliope 9056 May 6, 2003, 6:59 AM
Thread Re: [calliope] Global for ENUM-field (checkboxes)
webmaster33 8847 May 7, 2003, 6:30 AM
Thread Re: [webmaster33] Global for ENUM-field (checkboxes)
Paul 8812 May 7, 2003, 7:06 AM
Thread Re: [Paul] Global for ENUM-field (checkboxes)
webmaster33 8786 May 7, 2003, 7:13 AM
Thread Re: [webmaster33] Global for ENUM-field (checkboxes)
Paul 8791 May 7, 2003, 7:57 AM
Thread Re: [Paul] Global for ENUM-field (checkboxes)
webmaster33 8823 May 7, 2003, 8:05 AM
Post Post deleted by calliope
calliope 8737 May 7, 2003, 8:28 AM
Post Re: [webmaster33] Global for ENUM-field (checkboxes)
calliope 8794 May 7, 2003, 8:34 AM
Thread Re: [webmaster33] Global for ENUM-field (checkboxes)
Paul 8811 May 7, 2003, 8:36 AM
Thread Re: [Paul] Global for ENUM-field (checkboxes)
calliope 8801 May 7, 2003, 9:59 AM
Thread Re: [calliope] Global for ENUM-field (checkboxes)
webmaster33 8741 May 7, 2003, 2:07 PM
Thread Re: [webmaster33] Global for ENUM-field (checkboxes)
Aki 8779 May 8, 2003, 11:21 AM
Thread Re: [Aki] Global for ENUM-field (checkboxes)
webmaster33 8775 May 8, 2003, 3:02 PM
Thread Re: [webmaster33] Global for ENUM-field (checkboxes)
calliope 8700 May 8, 2003, 11:39 PM
Thread Re: [calliope] Global for ENUM-field (checkboxes)
jaltuve 8739 May 9, 2003, 10:38 AM
Thread Re: [jaltuve] Global for ENUM-field (checkboxes)
cwschroeder 8427 Jan 7, 2008, 5:30 AM
Post Re: [cwschroeder] Global for ENUM-field (checkboxes)
Andy 8447 Jan 7, 2008, 6:44 AM
Post Re: [Aki] Global for ENUM-field (checkboxes)
jaltuve 8677 May 9, 2003, 10:46 AM
Post Re: [calliope] Global for ENUM-field (checkboxes)
Paul 8719 May 7, 2003, 3:02 PM