Thanks for the quick reply - I'll check the plug-in later on.
I'm still not sure what to do about the select box...
Ivan, I read the thread you provided and I see the final code they came up with. I inserted that code in the "template globals" page where it said "new" thus creating a new global called "country", right? The code is:
sub { my $element_name = 'Country'; # set the control's name here
my $default_value = 'xyzty'; # and the default country you'd like to use
my @list = qw(
United States
Internet Based
Afghanistan
Albania
....
rest of the countries
...
Zimbabwe
);
grep { tr,_, ,;0 } @list;
# add your countries here. One per line is ok. my $return = q|<select class="Country" name="Country"><option value="">---</option>|; my $tags = shift || {};
my $selected = $tags->{$element_name} || $default_value;
$selected = { map {($_=>1)} ref $selected ? @$selected : $selected };
foreach my $country ( @list ) { my $ischosen = $selected->{$country} ? " selected" : ""; $return .= qq|<option$ischosen>$country</option>|; }
$return .= q|</select>|;
return $return; }
In the "include form.html" template I now have:
<tr><td valign="top"><%body_font%>Country: </font></td>
<td> <%Country%>>
</td></tr>
and when on the website I get this message where I wanted the select box to be:
Unable to compile 'Country':>
Have no idea what this all means - I'm not a perl programmer... all I know is how to copy and paste (+ minor changes" where I'm told
Thanks,
Anne
If you love cats - visit www.TheCatSite.com
Visit my LinkSQL based Cat Site - www.Meowhoo.com
I'm still not sure what to do about the select box...
Ivan, I read the thread you provided and I see the final code they came up with. I inserted that code in the "template globals" page where it said "new" thus creating a new global called "country", right? The code is:
sub { my $element_name = 'Country'; # set the control's name here
my $default_value = 'xyzty'; # and the default country you'd like to use
my @list = qw(
United States
Internet Based
Afghanistan
Albania
....
rest of the countries
...
Zimbabwe
);
grep { tr,_, ,;0 } @list;
# add your countries here. One per line is ok. my $return = q|<select class="Country" name="Country"><option value="">---</option>|; my $tags = shift || {};
my $selected = $tags->{$element_name} || $default_value;
$selected = { map {($_=>1)} ref $selected ? @$selected : $selected };
foreach my $country ( @list ) { my $ischosen = $selected->{$country} ? " selected" : ""; $return .= qq|<option$ischosen>$country</option>|; }
$return .= q|</select>|;
return $return; }
In the "include form.html" template I now have:
<tr><td valign="top"><%body_font%>Country: </font></td>
<td> <%Country%>>
</td></tr>
and when on the website I get this message where I wanted the select box to be:
Unable to compile 'Country':>
Have no idea what this all means - I'm not a perl programmer... all I know is how to copy and paste (+ minor changes" where I'm told
Thanks,
Anne
If you love cats - visit www.TheCatSite.com
Visit my LinkSQL based Cat Site - www.Meowhoo.com