[html-formfu] Constraints on repeatable fields

Mario Minati mario.minati at googlemail.com
Tue Aug 4 18:19:18 GMT 2009


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 at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>   




More information about the HTML-FormFu mailing list