Wow ... that was easy :)

In my case, 'Catalyst::Controller::HTML::FormFu' take care of running process, 
but it seems it's called BEFORE the repeat is executed.

Adding a $form->process right after my repeat works fine.

Thank you.

----- Original Message -----
From: "Mario Minati" <mario.min...@googlemail.com>
To: "HTML Form Creation, Rendering and Validation Framework" 
<html-formfu@lists.scsys.co.uk>
Sent: Tuesday, August 4, 2009 8:19:18 PM GMT +01:00 Amsterdam / Berlin / Bern / 
Rome / Stockholm / Vienna
Subject: Re: [html-formfu] Constraints on repeatable fields

Hi Yves,

did you call process?


Greets,

Mario Minati


Yves Räber schrieb:
> Hi,
>
> I'm trying to add a required constraint to repeatable fields, but FormFu 
> seems to simply ignore the constraints.
>
> Here is the simplest example I could think of :
>
> yml:
> ---
> elements:
>   - type: Repeatable
>     name: my_rep
>     elements:
>             
>       - name: foo
>         label: Foo
>         constraints:
>           - type: Required
>       
>   - type: Submit
>     name: submit
>
> catalyst controller:
>
> sub test :Local :FormConfig {
>     my ( $self, $c ) = @_;
>
>    my $form  = $c->stash->{form};
>    $form->get_all_element({ type => 'Repeatable' })->repeat(2);
>
> }
>
> Here is the constraint debug messages when I send the form without anything 
> in both fields :
>
> HTML::FormFu::_constrain_input()
> FIELD NAME: 'foo_1'
> CONSTRAINT TYPE: 'Required'
>
> HTML::FormFu::Constraint::process()
> CONSTRAINT RETURN VALUE: '0'
> $@: ''
>
> HTML::FormFu::_constrain_input()
> ERRORS: [
>           bless( {}, 'HTML::FormFu::Exception::Constraint' )
>         ];
> $@: ''
>
> I think I'm missing something here, any help would be very welcome.
>
> Thank you.
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu@lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>   


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to