Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Help with checkbox global

Quote Reply
Help with checkbox global
Hi, I have recently made a series of checkbox's with this global provided by support@gossamer

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

sub {
my $field = shift;
my $tags = GT::Template->tags;
my $form_names =
$DB->table('Links')->cols->{$field}->{form_names};
my $form_values =
$DB->table('Links')->cols->{$field}->{form_values};
my $values = $tags->{$field};
my @values = $IN->>param($field) ?
my @values = $IN->>$IN->param($field) : split('\n', $values);

my @selected_values;
if ( @values ) {
my $i = 0;
foreach my $f ( @$form_names ) {
my $checked = 0;
foreach ( @values ) {
if ( $f eq $_ ) {
$checked = 1;
}
}
my $name = $form_values->[$i];
push @selected_values, { name => $name, value => $f, checked => $checked };
$i++;
}
}
else {
my $i = 0;
foreach my $f ( @$form_names ) {
my $name = $form_values->[$i];
push @selected_values, { name => $name, value => $f };
$i++;
}
}
return { selected_values => \@selected_values };
}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I was then told to display the check box's to add this to include_form.html

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<tr><td align="right" valign="top"><%body_font%>Payment Type:</font></td>
<td>
<%body_font%><%selected_value_field('processor')%><%loop selected_values%><%if checked%>
<input type="checkbox" name="processor" value="<%name%>" checked><%name%><%else%>
<input type="checkbox" name="processor"
value="<%name%>"><%name%><%endif%>
<%if name eq 'PayPal'%><br><%endif%>
<%endloop%></font></td></tr>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This work's and the checkbox's display in add and modify.html

I assumed I would use <p>Payment Type: <%processor%></p> in my detailed.html for it to display but now have been told I need another global??

Can somebody please show me how this is down so when I select multiple checkbox's they all display on one line eg; Payment Type: PayPal,Ibill,Cash


Thank's for your time...
Quote Reply
Re: [alesis404] Help with checkbox global In reply to
Problem has been resolved thanks to virginia@gossamer

**Should have been "text" instead of "enum"