Hi Simon,

If I understand you correctly, I can see two ways:

   1. Using per element validators using the second parameter to
   isValid() which is "context" which contains the data of the whole form so
   you can also check, I think there is an example that uses it in the manual.
   2. Overriding the subForm's isValid. The only problem you will face is
   that you will not be able to set the error message on the elements as they
   can be set from inside the element only (there is an issue for this in the
   tracker btw). But you can get around this I'm sure.

Best Regards,
- Amr

On Sat, May 3, 2008 at 4:24 AM, Simon Mundy <[EMAIL PROTECTED]>
wrote:

> Hi Matthew
>
> Is there a way to determine a form's validity by other means than the
> per-element validators?
>
> I was trying to set up a form where a subform had the following:-
>
> Age: 18-21 [Text box]
> Age: 22-30 [Text box]
> Age: 31+ [Text box]
>
> What I wanted was to set up Integer validators on each of these text
> fields. But then I also wanted to validate by entering a value in at least
> one of the text fields - it could be 1 or all 3, but we don't mind which
> ones.
>
> If I were to use a similar example, PEAR's form has the 'addFormRule' and
> 'addGroupRule' APIs for handling such a situation as counting the number of
> valid elements, but I can't find anything similar for Zend_Form. Is this in
> the territory of feature request? Or can this be handled by the existing
> validation functionality?
>
> Cheers
>
> --
>
> Simon Mundy | Director | PEPTOLAB
>
> """ " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
>
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
> http://www.peptolab.com
>
>


-- 
Amr Mostafa, Head of Software Development, IT Synergy
[EMAIL PROTECTED] http://itsyn.com
+(2012)1700502 +(202)35371020

Reply via email to