Hi,
I use C::C::FormBuilder which lacks complex validation. I looked
around and want to use C::P::FormValidator::Simple::Auto with external
yaml files.
$c->config->{validator}->{profiles} gets filled from my profile file but
current profile ($c->validator_profile) is never filled.
This should be done in a C::P::FV::S::A forward method but true test
$c->config->{validator}{profiles}{ $action }
is never ok.
I call my run action having forms like this:
$c->forward('run');
And calling $c->form->has_error within run action should throw an
error according to profile rules. Object $c->form is
FormValidator::Simple::Results object. It has only message part but
profile part is missing.
Cannot find out why this behaviour. Could someone shed some light?
......................
sub forward {
my $c = shift;
my $action = $c->dispatcher->_invoke_as_path($c, @_);
no warnings 'once';
local $NEXT::NEXT{ $c, 'forward' };
my $res;
if ( my $profile = $c->config->{validator}{profiles}{ $action } ) {
# first time validation
if (not $c->validator_profile) {
$c->{validator_profile} = $action;
$c->form(%$profile);
$res = $c->NEXT::forward(@_);
}
else {
# don't override validator stuffs when not first time validation
local $c->{validator} = FormValidator::Simple->new;
local $c->{validator_profile} = $action;
$c->form(%$profile);
$res = $c->NEXT::forward(@_);
}
}
else {
$res = $c->NEXT::forward(@_);
}
$res;
}
...................
--
Radek
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/