[Templates] Way of using CGI and checkboxes is giving problems
Rafael Caceres
rcaceres@aasa.com.pe
Mon, 25 Nov 2002 17:07:56 -0500
Instead of using the CGI pluggin, I have been using the following in perl
code to use the CGI module in various applications. This has been done,
primarily to gain access to the query before processing a template:
use vars qw{$query};
$query = new CGI;
then add $query to the variables passed to a template, like so:
$vars = {
'version' => 0.01,
'query' => $query,
'page_title' => "App Name "
};
In the template, I've been putting fields using the following styles:
For a hidden field:
[% query.hidden({name=>'FORMSHOWN',default=>'1',override=>1}) %]
or
[% query.hidden( {name=>'USERNAME', default=>query.param('USERNAME'),
override=>1}) %]
For a 'non-editable' "field":
User: [% query.param('USERNAME') %]
For a textfield:
Name: [% query.textfield({name=>'FULLNAME',size=>40, maxlength=>40}) %]
The checkbox fields, placed like:
Active: [% query.checkbox({name=>'ACTIVE',label=>" "}) %]
are causing the [% query.end_form %] at the end of the form to appear as:
ARRAY(0x12345).
Just commenting out the checkbox field construction, results in the end of
form HTML being properly constructed. Other than constructing a minimal
case, to verify the above, I'm lost. Can anybody point out what's going on?
Thanks,
Rafael Caceres