There's already support for validating against other form fields, but you have to write your own validator to do it:
class My_Validator implements Zend_Validate_Interface { public function isValid($value, $context = null) { /* $context is array of all form values */ } } Zend_Validate_Branch sounds like a way to simplify this. How do you suppose it'd work? -- Hector On Tue, Dec 22, 2009 at 5:23 PM, Steven Brown <ste...@yewchube.com> wrote: > I think this calls for a new component Zend_Validate_Branch that would > allow the validator chain to branch depending on values of other form > fields. Anyone agree? > > > > *From:* Hector Virgen [mailto:djvir...@gmail.com] > *Sent:* Wednesday, 23 December 2009 2:59 AM > *To:* Guillaume ORIOL > *Cc:* fw-general@lists.zend.com > *Subject:* Re: [fw-general] isValid not executed on multicheckbox when the > element is not required and value is not set > > > > Place the validator at the choice1 element. You can write a custom > validator that accepts a $context array as the second parameter to filter() > which will contain the rest of the forms values. You can then test the > checkboxes at that point. > > -- > Hector > > On Tue, Dec 22, 2009 at 5:54 AM, Guillaume ORIOL <gor...@technema.fr> > wrote: > > Here is a schematic view of the form I have: > (*) choice 1 > [X] option 1 > [_] option 2 > [_] option 3 > ( ) choice 2 > > When "choice 1" is checked, at least one of the three options should be > checked. > I wanted to write a specific validator for the options but... > as the "options" multi-checkbox is not required (as they are ignored if > choice 2 is checked), when no option is checked, the validator is not > executed at all. > > Does anybody have a solution for it? > > Thanks > -- > > Guillaume ORIOL > > >