Cataly...InForm(3pm)
π Catalyst::Plugin::FillInForm β like, the whole vibe π
okay bestie, pull up a chair π«Ά this is Cataly...InForm(3pm) from the User Contributed Perl Documentation, and it's about Catalyst::Plugin::FillInForm β the plugin that fills your forms back in so your users don't have to retype their whole life after one tiny validation error. iconic behavior, honestly.
β¨ NAME β¨
Catalyst::Plugin::FillInForm β FillInForm for Catalyst π
πΈ SYNOPSIS πΈ
use Catalyst 'FillInForm';
# that's it, if Catalyst::Plugin::FormValidator is being used
# OR, manually:
# in Controller/Root.pm; assume $c->stash->data is seeded elsewhere
sub end : Private {
my ( $self, $c ) = @_;
$c->forward('MyApp::View::TT') unless $c->res->output;
$c->fillform( $c->stash->data );
# ....
like literally that first line is the whole thing if Catalyst::Plugin::FormValidator is already in the mix. no extra steps, we love a low-effort slay β¨
π¦ DESCRIPTION π¦
So the whole point: fill forms automatically, based on data from a previous HTML form. Typically (but not necessarily) used in conjunction with Catalyst::Plugin::FormValidator. This module automatically inserts data from a previous HTML form into HTML input fields, textarea fields, radio buttons, checkboxes, and select tags. It's an instance of HTML::FillInForm, which itself is a subclass of HTML::Parser, which it uses to parse the HTML and insert the values into the proper form tags. it's giving parser-ception, no cap π
The usual application is after a user submits an HTML form without filling out a required field, or with errors in fields having specified constraints. FillInForm is used to redisplay the HTML form with all the form elements containing the submitted info. FillInForm can also be used to fill forms with data from any source, e.g. directly from your database. π database girlies, this one's for you.
π EXTENDED METHODS π
finalize
Will automatically fill in forms, based on the parameters in "$c->req->parameters", if the last form has missing or invalid fields, and if "Catalyst::Plugin::FormValidator" is being used. "finalize" is called automatically by the Catalyst Engine; the end user will not have to call it directly. (In fact, it should never be called directly by the end user.)
π¨ bestie listen β never call finalize yourself. the Engine handles it. touching it manually is not the move, fr fr.
π METHODS π
fillform
Fill a form, based on request parameters (the default) or any other specified data hash. You'd call this manually if you're getting your data from some source other than the parameters (e.g. if you're seeding an edit form with the results of a database query), or if you're using some other validation system than "Catalyst::Plugin::FormValidator".
$c->fillform; # defaults to $c->req->parameters
# OR
$c->fillform( \%data_hash );
"fillform" must be called after an HTML template has been rendered. A typical way of using it is to place it immediately after your "forward" call to your view class, which might be in a built-in "end" action in your application class.
You can also hand in a hashref of additional params for HTML::FillInForm->fill() if you like. Explicitly providing a \%data_hash is mandatory for this use case.
$c->fillform( $c->req->parameters, {
ignore_fields => [ 'pagesrc', 'pagedst' ],
fill_password => 0,
} );
so yeah β pass the data hash explicitly if you're also passing the extra HTML::FillInForm->fill() params. mandatory, not optional, iykyk π
π NOTES π
This class does not play well with Catalyst's ActionClass('RenderView'), so you may want to check your "end" method (in Controller/Root.pm or perhaps MyApp.pm). If it looks like this:
sub end : ActionClass('RenderView') {}
Then you'll need to change it to something like this:
sub end : Private {
my ($self, $c) = @_;
$c->forward('render');
$c->fillform($c->req->params) unless $c->res->output;
}
sub render : ActionClass('RenderView') { }
like, they simply don't vibe together π₯² split the end action up and give render its own little moment, and you're golden.
π SEE ALSO π
CatalystCatalyst::Plugin::FormValidatorHTML::FillInFormCatalyst::Action::RenderView
go read those if you wanna go deeper, bestie π
β AUTHOR β
- Sebastian Riedel,
"sri@cpan.org" - Marcus Ramberg,
"mramberg@cpan.org" - Jesse Sheidlower,
"jester@panix.com" - Jay Hannah,
"jay@jays.net"
π COPYRIGHT π
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, periodt π
β¨ this was Cataly...InForm(3pm), perl v5.32.0, dated 2021-01-07 β thanks for reading bestie, go fill in some forms π«Άπ
π¦ where this page comes from
- debian bookworm: libcatalyst-plugin-fillinform-perl 0.12-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-plugin-fillinform-perl 0.12-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libcatalyst-plugin-fillinform-perl 0.12-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-plugin-fillinform-perl 0.12-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms