CGI::Ap...uperForm(3)
πΈ NAME πΈ
CGI::Application::Plugin::SuperForm β create sticky HTML forms in CGI::Application run modes using HTML::SuperForm. bestie. sticky forms. we love to see it π
β¨ SYNOPSIS β¨
use CGI::Application::Plugin::SuperForm;
sub form_runmode {
my $c = shift;
my $form_start = $c->superform->start_form(
{
method => "POST",
action => $c->query()->url() . "/myapp/form_process",
}
);
my $text = $c->superform->text( name => 'text', default => 'Default Text' );
my $textarea = $c->superform->textarea(
name => 'textarea',
default => 'More Default Text'
);
my $select = $c->superform->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
return $output;
}
okay so that's the whole vibe in one run mode β you grab your form bits, you smash them into a heredoc, you return it. the fields stay sticky, which is the whole point. slay π
π«Ά DESCRIPTION π«Ά
Create sticky forms with HTML::SuperForm. that's it, that's the pitch, and it ate. β¨
π METHODS π
sformβ an alias tosuperform. same energy, shorter name. iykyk πsuperformβ hands you back an instance ofHTML::SuperFormthat's preconfigured with sticky and fallback options on. wanna know more? more info and examples live over inHTML::SuperForm. go look, bestie π¦
π EXAMPLE USING TT PLUGIN π
A simplistic but working app SuperForm, TT and AutoRunmode plugins. TT brings in c var to templates automatically, SuperForm brings in sform. no cap, that's the whole setup π
π Files:
./lib/MyApp.pm
.MyApp/form.tmpl
./server.pl
π lib/MyApp.pm
package MyApp;
use base 'Titanium';
use CGI::Application::Plugin::TT;
use CGI::Application::Plugin::SuperForm;
use CGI::Application::Plugin::AutoRunmode;
sub form: Runmode{
my $c = shift;
$c->tt_process();
}
sub process_form(): Runmode{
my $c = shift;
# do something with user input.
# redirect to success page, etc.
return "You said: ". $c->query()->param('input1');
}
1; # End of MyApp
πΈ MyApp/form.tmpl
<html>
[% c.sform.start_form({method=>"POST"}) %]<br/>
Say what? [% c.sform.text({name=>"input1"}) %]<br/>
[% c.sform.hidden({name=>"rm", value=>"process_form"}) %]<br/>
[% c.sform.submit()%]<br/>
[% c.sform.end_form() %]<br/>
</html>
π§ .server.pl
use warnings;
use strict;
use CGI::Application::Server;
use lib 'lib';
use MyApp;
my $app = MyApp->new(PARAMS => {});
my $server = CGI::Application::Server->new();
$server->document_root('.');
$server->entry_points({
'/index.cgi' => $app,
});
$server->run;
π¦ SEE ALSO π¦
HTML::SuperForm, Titanium, CGI::Application. go read them, they're iconic π
β AUTHOR β
Gordon Van Amburg, "gordon@minipeg.net" β the main character who wrote this π«Ά
π LICENSE π
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself. periodt.
and that's a wrap bestie π this was perl v5.42.0, dated 2025-07-25, and the page you just read is CGI::Ap...uperForm(3) β go forth and make them sticky forms, no cap π
π¦ where this page comes from
- fedora 43: perl-CGI-Application-Plugin-SuperForm 0.5-44.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms