2008/12/9 Ronald J Kimball <[EMAIL PROTECTED]>:
> I'm curious about what would be best practice for doing "conditional
> constraints", such as: if fieldA's value is 'foo', then fieldB is required;
> or if fieldA's value is 'bar', then fieldB must have the value 'baz'.  Have
> other people had to do something like this?  What would be a good way to
> accomplish it?
>
> Perhaps a constraint derived from HTML::FormFu::Constraint::_others, with
> some additional configuration available...

Check out $constraint->when()
http://search.cpan.org/~cfranks/HTML-FormFu-0.03007/lib/HTML/FormFu/Constraint.pm#when

If the docs aren't clear, there's examples in the test suite:
    t/constraints/constraint_when.t
    t/constraints/constraint_when.yml

Carl

_______________________________________________
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