| 1 |
NAME |
| 2 |
CGI::Application::Plugin::FillInForm - integrate with HTML::FillInForm |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use CGI::Application::Plugin::FillInForm (qw/fill_form/); |
| 6 |
|
| 7 |
my $t = $self->load_tmpl('farm.html'); |
| 8 |
$t->param( organic => 'less_pesticides' ); |
| 9 |
|
| 10 |
return $self->fill_form( \$t->output ); |
| 11 |
|
| 12 |
DESCRIPTION |
| 13 |
This plugin provides a mix-in method to make using HTML::FillInForm more |
| 14 |
convenient. |
| 15 |
|
| 16 |
fill_form() |
| 17 |
# fill an HTML form with data in a hashref or from an object with with a param() method |
| 18 |
my $filled_html = $self->fill_form($html, $data); |
| 19 |
|
| 20 |
# ...or fill from a list of data sources |
| 21 |
# (each item in the list can be either a hashref or an object) |
| 22 |
my $filled_html = $self->fill_form($html, [$user, $group, $query]); |
| 23 |
|
| 24 |
# ...or default to getting data from $self->query() |
| 25 |
my $filled_html = $self->fill_form($html); |
| 26 |
|
| 27 |
# extra fields will be passed on through: |
| 28 |
my $filled_html = $self->fill_form($html, undef, fill_password => 0 ); |
| 29 |
|
| 30 |
This method provides an easier syntax for calling HTML::FillInForm, and |
| 31 |
an intelligent default of using $self->query() as the default data |
| 32 |
source. |
| 33 |
|
| 34 |
By default, the mode param (usually 'rm') of every data source will be |
| 35 |
ignored. This prevents accidently clobbering your run mode for the next |
| 36 |
page, which may be stored in a hidden field. |
| 37 |
|
| 38 |
$html must be a scalarref, or a reference to a scalarref. $filled_html |
| 39 |
will be a reference to a string. |
| 40 |
|
| 41 |
Because this method only loads HTML::FillInForm if it's needed, it |
| 42 |
should be reasonable to load it in a base class and always have it |
| 43 |
available: |
| 44 |
|
| 45 |
use CGI::Application::Plugin::FillInForm (qw/fill_form/); |
| 46 |
|
| 47 |
AUTHORS |
| 48 |
Cees Hek published the first draft on the CGI::App wiki |
| 49 |
Mark Stosberg, C<< <[email protected]> >> polished it for release. |
| 50 |
Michael Graham, C<< <[email protected]> >> added tests and some new features. |
| 51 |
The module is now co-maintained by Mark and Michael. |
| 52 |
|
| 53 |
BUGS |
| 54 |
Please report any bugs or feature requests to |
| 55 |
"[email protected]", or through the web |
| 56 |
interface at <http://rt.cpan.org>. I will be notified, and then you'll |
| 57 |
automatically be notified of progress on your bug as I make changes. |
| 58 |
|
| 59 |
CONTRIBUTING |
| 60 |
Patches, questions and feedback are welcome. This project is managed |
| 61 |
using the darcs source control system ( http://www.darcs.net/ ). My |
| 62 |
darcs archive is here: http://mark.stosberg.com/darcs_hive/cap-fif/ |
| 63 |
|
| 64 |
Copyright & License |
| 65 |
Copyright 2005 Mark Stosberg, All Rights Reserved. |
| 66 |
|
| 67 |
This program is free software; you can redistribute it and/or modify it |
| 68 |
under the same terms as Perl itself. |
| 69 |
|