[Catalyst] FormValidator::Simple and FillInForm plugins refuse to work together
John Napiorkowski
jjn1056 at yahoo.com
Wed May 17 15:54:34 CEST 2006
Alex,
I also had trouble with FillInForm. When researching
the trouble I found some notes about it having trouble
when the input tag had a 'type="text"' attribute in
it. Removing that didn't actually solve my problem
but it seemed to help that person so you might want to
try it out.
Personally I dropped using FillInForm as a plugin
since I found it heavily impacted performance on my
website. Also it has trouble when a page had multiple
forms on it, which is common on the site I am
designing. Although I am not an expert on the plugin
from what I can tell it parses all pages whether they
have a form in it or not, which would account for the
performance issue. Your results may vary. Good luck.
--john
--- Alex Morozov <inductor2000 at mail.ru> wrote:
> Hello everyone.
>
> Did anyone face a strange problem with these two
> plugins?
> I use Catalyst on ActivePerl 5.8.7 and the following
> code doesn`t render
> a page at all:
>
> Main module:
>
> use Catalyst qw/-Debug ConfigLoader Static::Simple
> Authentication
> Authentication::Store::DBIC
> Authentication::Credential::Password
> Session Session::Store::File
> Session::State::Cookie
> FormValidator::Simple FillInForm/;
>
> C::Users, 'new user' sub:
>
> sub create {
> my ($self, $c) = @_;
>
> $c->stash->{template} = 'create.tt';
> if ($c->request->method eq 'POST') {
> $c->form (
> email => [qw/NOT_BLANK EMAIL_LOOSE/],
> name => ['NOT_BLANK', ['DBIC_UNIQUE',
> $c->model('DB::Users'), 'name']],
> password => [qw/NOT_BLANK/, [qw/LENGTH 6
> 999/]]
> );
> if ($c->form->has_error) {
> $c->fillform;
> return;
> }
> my $email = $c->request->params->{'email'};
> my $name = $c->request->params->{'name'};
> my $password =
> $c->request->params->{'password'};
> my $users = $c->model('DB::Users');
> $users->create({'email' => $email, 'name' =>
> $name, 'password'
> => $password});
>
> $c->stash->{message} = 'User created. ';
> }
> else {
> $c->stash->{message} = 'Create a user:';
> }
> }
>
> sub end : Private {
> my ($self, $c) = @_;
> $c->forward('tour::View::tt') unless
> $c->res->body();
> }
>
>
> create.tt contents:
>
> <html>
> <head>
> <title>Create a user</title>
> </head>
> <body>
> [% IF c.form.has_error %]
> <h3>Error!</h3>
> <ul>
> [% IF c.form.missing('name') %]
> <li>Missing name!
> [% END %]
> [% IF c.form.invalid('name') %]
> <li>Invalid name!
> [% END %]
> [% IF c.form.missing('email') %]
> <li>Missing email!
> [% END %]
> [% IF c.form.invalid('email') %]
> <li>Invalid email!
> [% END %]
> [% IF c.form.missing('password') %]
> <li>Missing password!
> [% END %]
> [% IF c.form.invalid('password') %]
> <li>Invalid password!
> [% END %]
> </ul>
> [% END %]
> [% message %]
> <form action="[% c.request.uri %]"
> method="post">
> Email: <input type=text
> name="email"><br>
> Name: <input type=text
> name="name"><br>
> Password: <input type=text
> name="password"><br>
> <input type=submit value="OK">
> </form>
> </body>
> </html>
>
>
> Well...
> When I remove FillInForm dependency in main module,
> all works fine. But
> if FillInForm is used, I get a blank page instead of
> rendered template.
> Catalyst doesn`t throw an exception, but says:
>
> Use of uninitialized value in list assignment at
> c:/Perl/site/lib/Catalyst/Engine/HTTP.pm line 228.
> Use of uninitialized value in list assignment at
> c:/Perl/site/lib/Catalyst/Engine/HTTP.pm line 228.
> Attempt to free unreferenced scalar: SV 0x24e0384,
> Perl interpreter:
> 0x2241ec at c:/Perl/site/lib/SQL/Abstract/Limit.pm
> line 325.
> Use of uninitialized value in subroutine entry at
> c:/Perl/site/lib/HTML/FillInForm.pm line 86.
> Use of uninitialized value in subroutine entry at
> c:/Perl/site/lib/HTML/FillInForm.pm line 86.
> Use of uninitialized value in print at
> c:/Perl/site/lib/Catalyst/Engine.pm line 577.
>
> I searched the maillist, but didn`t find anything
> related. Can anybody
> help me? Thanks in advance!
>
> --alex
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Catalyst
mailing list