1CGI::FormBuilder::TemplUasteer::CCoGnIt_rSiSbIu(t3e)d PeCrGlI:D:oFcourmmeBnutialtdieorn::Template::CGI_SSI(3)
2
3
4

NAME

6       CGI::FormBuilder::Template::CGI_SSI - FormBuilder interface to CGI::SSI
7

SYNOPSIS

9           my $form = CGI::FormBuilder->new(
10                           fields   => \@fields,
11                           template => {
12                             type => 'CGI_SSI',
13                             file => "template.html",
14                           },
15                      );
16

DESCRIPTION

18       This engine adapts FormBuilder to use "CGI::SSI".
19
20       You can specify any options which "CGI::SSI->new" accepts by using a
21       hashref:
22
23           my $form = CGI::FormBuilder->new(
24                           fields => \@fields,
25                           template => {
26                               type => 'CGI::SSI',
27                               file => 'form.shtml',
28                               sizefmt => 'abbrev'
29                           }
30                       );
31
32       In addition to CGI::SSI new arguments, you can also specify "file",
33       "virtual", or "string" argument.
34
35       The following methods are provided (usually only used internally):
36
37   engine
38       Returns a reference to the "CGI::SSI" object
39
40   prepare
41       Returns a hash of all the fields ready to be rendered.
42
43   render
44       Uses the prepared hash and expands the template, returning a string of
45       HTML.
46

TEMPLATES

48       In your template, each of the form fields will correspond directly to a
49       "<!--#echo -->" of the same name prefixed with "field-" in the
50       template. So, if you defined a field called "email", then you would
51       setup a variable called "<!--#echo var="field-email" -->" in your
52       template.
53
54       In addition, there are a couple special fields:
55
56           <!--#echo var="js-head" -->     -  JavaScript to stick in <head>
57           <!--#echo var="form-title" -->  -  The <title> of the HTML form
58           <!--#echo var="form-start" -->  -  Opening <form> tag and internal fields
59           <!--#echo var="form-submit" --> -  The submit button(s)
60           <!--#echo var="form-reset" -->  -  The reset button
61           <!--#echo var="form-end" -->    -  Just the closing </form> tag
62
63       Let's look at an example "form.html" template we could use:
64
65           <html>
66           <head>
67           <title>User Information</title>
68           <!--#echo var="js-head" --><!-- this holds the JavaScript code -->
69           </head>
70           <!--#echo var="form-start" --><!-- this holds the initial form tag -->
71           <h3>User Information</h3>
72           Please fill out the following information:
73           <!-- each of these <!--#echo -->'s corresponds to a field -->
74           <p>Your full name: <!--#echo var="field-name" -->
75           <p>Your email address: <!--#echo var="field-email" -->
76           <p>Choose a password: <!--#echo var="field-password" -->
77           <p>Please confirm it: <!--#echo var="field-confirm_password-->
78           <p>Your home zipcode: <!--#echo var="field-zipcode -->
79           <p>
80           <!--#echo var="form-submit" --><!-- this holds the form submit button -->
81           </form><!-- can also use "tmpl_var form-end", same thing -->
82
83       As you see, you get a "<!--#echo -->" for each for field you define.
84
85       However, you may want even more control. That is, maybe you want to
86       specify every nitty-gritty detail of your input fields, and just want
87       this module to take care of the statefulness of the values. This is no
88       problem, since this module also provides several other "<tmpl_var>"
89       tags as well:
90
91           <!--#echo var="value-[field] -->   - The value of a given field
92           <!--#echo var="label-[field] -->   - The human-readable label
93           <!--#echo var="comment-[field] --> - Any optional comment
94           <!--#echo var="error-[field] -->   - Error text if validation fails
95           <!--#echo var="required-[field] --> - See if the field is required
96
97       This means you could say something like this in your template:
98
99           <!--#echo var="label-email" -->:
100           <input type="text" name="email" value="<!--#echo var="value-email" -->">
101           <font size="-1"><i><!--#echo var="error-email" --></i></font>
102
103       And FormBuilder would take care of the value stickiness for you, while
104       you have control over the specifics of the "<input>" tag.  A sample
105       expansion may create HTML like the following:
106
107           Email:
108           <input type="text" name="email" value="nate@wiger.org">
109           <font size="-1"><i>You must enter a valid value</i></font>
110
111       Note, though, that this will only get the first value in the case of a
112       multi-value parameter (for example, a multi-select list).  Multiple
113       values (loops) in "CGI_SSI" are not yet implemented.
114
115       For more information on templates, see HTML::Template.
116

SEE ALSO

118       CGI::FormBuilder, CGI::FormBuilder::Template, HTML::Template
119

REVISION

121       $Id: HTML.pm 97 2007-02-06 17:10:39Z nwiger $
122

AUTHOR

124       Copyright (c) Nate Wiger <http://nateware.com>. All Rights Reserved.
125
126       This module is free software; you may copy this under the terms of the
127       GNU General Public License, or the Artistic License, copies of which
128       should have accompanied your Perl kit.
129
130
131
132perl v5.34.0                      2021-07C-G2I2::FormBuilder::Template::CGI_SSI(3)
Impressum