[Catalyst] FormValidator usage / enhancements
Kiefer, Sascha
sk at intertivity.com
Wed Dec 7 11:25:16 CET 2005
Have you looked at the FormValidator::Simple plugin yet ?
Regards,
--esskar
> -----Original Message-----
> From: catalyst-bounces at lists.rawmode.org
> [mailto:catalyst-bounces at lists.rawmode.org] On Behalf Of Carl Franks
> Sent: Mittwoch, 7. Dezember 2005 11:02
> To: Catalyst Mailing List
> Subject: [Catalyst] FormValidator usage / enhancements
>
>
> I'm experimenting with how best to use the FormValidator
> plug-in. I think it's far too complicated, particularly on
> pages where it's not appropriate to use it in conjunction
> with FillInForm and you actually have to use the API !
>
> What I've done at the moment is create a plug-in which
> subclasses Catalyst::Plugin::FormValidator and looks like this:
>
> package Catalyst::Plugin::FormValidator::MergeRequest;
> use strict;
> use NEXT;
> use base 'Catalyst::Plugin::FormValidator';
>
> sub form {
> my $c = shift;
>
> if (@_) {
> $c->NEXT::form( $c, @_ );
>
> # logic here
> # see below for discussion
> }
>
> return $c->{form};
> }
>
> 1;
>
> What I want the 'login' part to do is:
> For 'invalid' input, delete it from the request parameters.
> For 'valid' input, put it into the request parameters
> (because it may have been changed by FormValidator filters).
>
> To do this, is it "acceptable" to change values and delete
> keys from the hash-ref returned by $c->req->parameters() ?
> Will this break anything?
>
> I'm also unsure about 'unknown' input. As the
> Data::FormValidator docs say, "Whether or not this indicates
> an error in the user input is application dependant". Maybe
> add another method to optionally strip unknowns from the
> request parameters? $c->delete_unknown_params
>
> The purpose of this, is so only the 'auto' routine needs to
> deal with $c->form stuff such as invalid and valid The action
> routine can simply use $c->req->params as normal, assuming
> that all is well.
>
> Thoughts? Ideas?
>
> Carl
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
More information about the Catalyst
mailing list