On Sun, May 4, 2008 at 2:24 AM, Simon Mundy <[EMAIL PROTECTED]> wrote:
> Also since this check is essentially to validate the subform and not the > elements themselves, I was hoping to direct error messages to inside the > <fieldset> rather than for the first element. It seems more logical to me to > ask the subform if there's a minimum/maximum number of valid elements rather > than performing it at element-level. > > I guess I can run with option 2 but I also need to work out where I can > generate an error message if at least 1 of these text boxes has not value. > Just my own thought on this, I would try the errors decorator way first. It pulls the messages from the element/form using getMessages(). Which means I'd have to override the subForm's getMessages() to return what I need. In Element.php the messages are stored in a protected $_messages in the isValid() and getMessages() returns just that. I'd use the same in my subForm. > > Food for thought... > > Cheers! > > 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 > > > -- > > 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
