HTML::SuperForm is a HTML form generator.
SYNOPSIS
use HTML::SuperForm;
use Apache::Constants qw(OK);
sub handler {
my $r = shift;
my $form = HTML::SuperForm- >new($r);
my $text = $form- >text(name = > 'text',
default = > 'Default Text');
my $textarea = $form- >textarea(name = > 'textarea',
default = > 'More Default Text');
my $select = $form- >select(name = > 'select',
default = > 2,
values = > [ 0, 1, 2, 3],
labels = > {
0 = > 'Zero',
1 = > 'One',
2 = > 'Two',
3 = > 'Three'
});
my $output = < < "END_HTML";
< html >
< body >
< form >
Text Field: $text< br >
Text Area: $textarea< br >
Select: $select
< /form >
< /body >
< /html >
END_HTML
$r- >content_type('text/html');
$r- >send_http_header;
$r- >print($output);
return OK;
}
OR
#!/usr/bin/perl
my $form = HTML::SuperForm- >new();
my $text = $form- >text(name = > 'text',
default = > 'Default Text');
my $textarea = $form- >textarea(name = > 'textarea',
default = > 'More Default Text');
my $select = $form- >select(name = > 'select',
default = > 2,
values = > [ 0, 1, 2, 3],
labels = > {
0 = > 'Zero',
1 = > 'One',
2 = > 'Two',
3 = > 'Three'
});
my $output = < < "END_HTML";
< html >
< body >
< form >
Text Field: $text< br >
Text Area: $textarea< br >
Select: $select
< /form >
< /body >
< /html >
END_HTML
print "Content-Type: text/htmlnn";
print $output;
Used in its basic form, this module provides an interface for generating basic HTML form elements much like HTML::StickyForms does. The main difference is HTML::SuperForm returns HTML::SuperForm::Field objects rather than plain HTML. This allows for more flexibilty when generating forms for a complex application.
To get the most out of this module, use it as a base (Super) class for your own form object which generates your own custom fields. If you don't use it this way, I guess there's really nothing Super about it. Example are shown later in the document.
The interface was designed with mod_perl and the Template Toolkit in mind, but it works equally well in any cgi environment.
Product's homepage
Requirements:
· Perl