.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CGI::FormBuilder::Template::CGI_SSI 3" .TH CGI::FormBuilder::Template::CGI_SSI 3 2024-09-01 "perl v5.40.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME CGI::FormBuilder::Template::CGI_SSI \- FormBuilder interface to CGI::SSI .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 7 \& my $form = CGI::FormBuilder\->new( \& fields => \e@fields, \& template => { \& type => \*(AqCGI_SSI\*(Aq, \& file => "template.html", \& }, \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This engine adapts \fBFormBuilder\fR to use \f(CW\*(C`CGI::SSI\*(C'\fR. .PP You can specify any options which \f(CW\*(C`CGI::SSI\->new\*(C'\fR accepts by using a hashref: .PP .Vb 8 \& my $form = CGI::FormBuilder\->new( \& fields => \e@fields, \& template => { \& type => \*(AqCGI::SSI\*(Aq, \& file => \*(Aqform.shtml\*(Aq, \& sizefmt => \*(Aqabbrev\*(Aq \& } \& ); .Ve .PP In addition to CGI::SSI \fBnew\fR arguments, you can also specify \f(CW\*(C`file\*(C'\fR, \f(CW\*(C`virtual\*(C'\fR, or \f(CW\*(C`string\*(C'\fR argument. .PP The following methods are provided (usually only used internally): .SS engine .IX Subsection "engine" Returns a reference to the \f(CW\*(C`CGI::SSI\*(C'\fR object .SS prepare .IX Subsection "prepare" Returns a hash of all the fields ready to be rendered. .SS render .IX Subsection "render" Uses the prepared hash and expands the template, returning a string of HTML. .SH TEMPLATES .IX Header "TEMPLATES" In your template, each of the form fields will correspond directly to a \f(CW\*(C`\*(C'\fR of the same name prefixed with "field\-" in the template. So, if you defined a field called "email", then you would setup a variable called \f(CW\*(C`\*(C'\fR in your template. .PP In addition, there are a couple special fields: .PP .Vb 6 \& \- JavaScript to stick in \& \- The of the HTML form \& <!\-\-#echo var="form\-start" \-\-> \- Opening <form> tag and internal fields \& <!\-\-#echo var="form\-submit" \-\-> \- The submit button(s) \& <!\-\-#echo var="form\-reset" \-\-> \- The reset button \& <!\-\-#echo var="form\-end" \-\-> \- Just the closing </form> tag .Ve .PP Let's look at an example \f(CW\*(C`form.html\*(C'\fR template we could use: .PP .Vb 10 \& <html> \& <head> \& <title>User Information \& \& \& \&

User Information

\& Please fill out the following information: \& \*(Aqs corresponds to a field \-\-> \&

Your full name: \&

Your email address: \&

Choose a password: \&

Please confirm it: \&

Your home zipcode: \&

\& \& .Ve .PP As you see, you get a \f(CW\*(C`\*(C'\fR for each for field you define. .PP However, you may want even more control. That is, maybe you want to specify every nitty-gritty detail of your input fields, and just want this module to take care of the statefulness of the values. This is no problem, since this module also provides several other \f(CW\*(C`\*(C'\fR tags as well: .PP .Vb 5 \& \- The value of a given field \& \- The human\-readable label \& \- Any optional comment \& \- Error text if validation fails \& \- See if the field is required .Ve .PP This means you could say something like this in your template: .PP .Vb 3 \& : \& "> \& .Ve .PP And \fBFormBuilder\fR would take care of the value stickiness for you, while you have control over the specifics of the \f(CW\*(C`\*(C'\fR tag. A sample expansion may create HTML like the following: .PP .Vb 3 \& Email: \& \& You must enter a valid value .Ve .PP Note, though, that this will only get the \fIfirst\fR value in the case of a multi-value parameter (for example, a multi-select list). Multiple values (loops) in \f(CW\*(C`CGI_SSI\*(C'\fR are not yet implemented. .PP For more information on templates, see HTML::Template. .SH "SEE ALSO" .IX Header "SEE ALSO" CGI::FormBuilder, CGI::FormBuilder::Template, HTML::Template .SH REVISION .IX Header "REVISION" \&\f(CW$Id:\fR HTML.pm 97 2007\-02\-06 17:10:39Z nwiger $ .SH AUTHOR .IX Header "AUTHOR" Copyright (c) Nate Wiger . All Rights Reserved. .PP 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.