|
::Features
::Download
::Tutorial
::Examples
::Documentation ::Join the Mailing List ::List Archives ::Contribute |
|
NAMECGI::FormBuilder::Template::Fast - FormBuilder interface to CGI::FastTemplate
SYNOPSIS
my $form = CGI::FormBuilder->new(
fields => \@whatever,
template => {
type => 'Fast',
root => '/path/to/templates',
# use external files
define => {
form => 'form.txt',
field => 'field.txt',
invalid_field => 'invalid_field.txt',
},
# or define inline
define_nofile => {
form => '<html><head></head><body>$START_FORM
<table>$FIELDS</table>$SUBMIT $END_FORM</body></html>',
# etc.
},
},
);
DESCRIPTIONThis engine adapts FormBuilder to use You will need to define three templates:
my $form = CGI::FormBuilder->new(
# ...
template => {
type => 'FastTemplate',
root => '/path/to/templates',
define => {
form => 'form.txt',
field => 'field.txt',
invalid_field => 'invalid_field.txt',
},
# or, you can define templates directly
define_nofile => {
form => '<html><head></head><body>$START_FORM<table>'
'$FIELDS</table>$SUBMIT $END_FORM</body></html>',
# etc.
},
},
# ...
);
If you use Within each of the field templates, the following variables are available:
$NAME # $field->name
$FIELD # $field->tag (HTML input tag)
$VALUE # $field->value (first value only!)
$LABEL # $field->label
$COMMENT # $field->comment
$ERROR # $field->error
$REQUIRED # $field->required ? 'required' : 'optional'
All the fields are processed in sequence; valid fields use the
$TITLE # title of the form
$START_FORM # opening form tag
$SUBMIT # the submit button
$RESET # the reset button
$END_FORM # closing form tag
$JS_HEAD # validation JavaScript
Note that since
SEE ALSOthe CGI::FormBuilder manpage, the CGI::FormBuilder::Template manpage, the CGI::FastTemplate manpage
AUTHORCopyright (c) 2005-2006 Peter Eichman <peichman@cpan.org>. All Rights Reserved. Maintained as part of This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. |
| FormBuilder is © 2000-2006 Nate Wiger, with contributions from many people. |