[Html-widget] FormFu: Catalyst FormConfig + manual constraints
Mario Minati
mario.minati at googlemail.com
Tue Apr 17 21:11:33 GMT 2007
Am Dienstag 17 April 2007 15:35 schrieb Tobias Kremer:
> I just started playing around with HTML::FormFu and I'm really liking
> it up to now. However I haven't been able to use the FormConfig attribute
> in my Catalyst controller to load the basics of a form _AND_ afterwards
> add constraints manually. Here's my latest try:
>
> sub signup : Local : FormConfig {
> my( $self, $c ) = @_;
> $c->stash->{ 'form' }->constraint( {
> type => 'Callback',
> name => 'captcha',
> callback => sub { return 0; # just to see if it's working }
> } ); # as documented in HTML::FormFu::Constraint::Callback's POD
>
> my $form = $c->stash->{ 'form' };
> if( $form->submitted_and_valid ) { .. }
> }
>
> The constraint is not added to the form loaded via Config::Any. Am
> I doing something wrong? Or is it impossible to add constraints after
> using FormConfig to prepare the form?
>
> Thanks!
Hi Tobias,
I think you are missing a
$form->process( $c->request );
after assigning the new constraint.
Greets,
Mario
More information about the Html-widget
mailing list