The most impressive one I've seen is CGI::Application::Plugin::ValidateRM. It checks the input with Data::FormValidator and then redisplays the form with the errors and the input values refilled by HTML::FillInForm if it fails. Here's an example:
# This is the run mode that will be validated. Notice that it accepts
# some errors to be passed in, and on to the template system.
sub form_display {
my $self = shift;
my $errs = shift;
my $t = $self->load_tmpl('page.html');
$t->param($errs) if $errs;
return $t->output;
}
sub form_process {
my $self = shift;
use CGI::Application::Plugin::ValidateRM (qw/check_rm/);
my ($results, $err_page) = $self->check_rm('form_display','_form_pro
+file');
return $err_page if $err_page;
#.. do something with DFV $results object now
my $t = $self->load_tmpl('success.html');
return $t->output;
}
sub _form_profile {
return {
required => 'email',
msgs => {
any_errors => 'some_errors',
prefix => 'err_',
},
};
}
The other that looks interesting is Rose-HTML-Objects.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|