man > CGI::FormBuilder::Template::Fast

📛 NAME

CGI::FormBuilder::Template::Fast – FormBuilder interface to CGI::FastTemplate

🚀 Quick Reference

Use CaseCommandDescription
Create form with Fast engineCGI::FormBuilder->new(template => { type => 'Fast', ... })Selects this template adapter
Use external template filesdefine => { form => 'form.txt', field => 'field.txt', invalid_field => 'invalid_field.txt' }Points to separate template files
Define templates inlinedefine_nofile => { form => '...', ... }Embeds template strings directly in the code
Set template root directoryroot => '/path/to/templates'Base directory for external template files

📖 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.
            },
        },
   );

📝 DESCRIPTION

This engine adapts FormBuilder to use CGI::FastTemplate. Please read these docs carefully, as the usage differs from other template adapters in several important ways.

📋 Template Configuration

You need to define three templates: form, field, and invalid_field. You can use define to point to external files (recommended CGI::FastTemplate style), or define_nofile / define_raw to define them inline. Templates in define_nofile take precedence over define_raw, and both override define.

    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, define templates directly
            define_nofile => {
                form => '<html><head></head><body>$START_FORM<table>'
                        '$FIELDS</table>$SUBMIT $END_FORM</body></html>',
                # etc.
            },
        },
        # ...
    );

If you use define with external templates, you will probably also want to define your template root directory with the root parameter.

🔧 Field Template Variables

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'

📂 Form Template Variables

All the fields are processed in sequence; valid fields use the field template, and invalid fields the invalid_field template. The result from each is appended into the $FIELDS variable, which you should use in your form template. In the form template, you also have access to:

    $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 CGI::FastTemplate doesn't use anything other than simple scalar variables, there are no variables corresponding to the lists that other engines have (e.g. fields or options lists in TT2 or Text::Template).

🔗 SEE ALSO

CGI::FormBuilder, CGI::FormBuilder::Template, CGI::FastTemplate

👤 AUTHOR

Copyright (c) 2005-2006 Peter Eichman <peichman AT cpan.org>. All Rights Reserved.

Maintained as part of CGI::FormBuilder by Nate Wiger <nate AT wiger.org>.

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.

perl v5.28.1 2019-01-19 CGI::FormBuilder::Template::Fast(3pm)

CGI::FormBuilder::Template::Fast
📛 NAME 🚀 Quick Reference 📖 SYNOPSIS 📝 DESCRIPTION
📋 Template Configuration 🔧 Field Template Variables 📂 Form Template Variables
🔗 SEE ALSO 👤 AUTHOR

Generated by phpman v4.9.25-3-gdbaf087 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-06 19:37 @216.73.217.93
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format

^_top_^