ZF-2988: Add public accessors for errors and messages for elements
Description
I didn't want to add a custom validators and decided to override my form's isValid() instead. Doing my custom logic there was straightforward, except that I couldn't set the errors on my elements as they are managed internally by Zend_Form_Element with no public accessors.
I propose that we add public accessors for errors and messages. It makes sense regardless of the use case I demonstrated.
Comments
Posted by Andries Seutens (andries) on 2008-03-31T15:22:50.000+0000
Currently, you always have to write your own validator, in order to get an error in the stack. I also think it'd be usefull to have a method to push your own custom errors into the error stack on a per element basis:
It would also be convenient to be able to do this on form level, where the input would be an array:
vote +1
Posted by Wil Sinclair (wil) on 2008-03-31T16:04:35.000+0000
Please evaluate and categorize as necessary.
Posted by Steven Reed (stevereed) on 2008-05-22T03:46:26.000+0000
Can this please include hasErrors()?
An example use case would be determining whether or not to add an 'error' class to a tag when using the ViewScript decorator:
// label/element output herePosted by Matthew Weier O'Phinney (matthew) on 2008-07-17T14:19:07.000+0000
New functionality complete as of r10162.
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:22.000+0000
Updating for the 1.6.0 release.