The Zend_Form decorator system insists on displaying form errors as lists next to the field triggering the error. This is not always the behaviour that is desired. For instance, you may wish to display only the first error encountered, and show this above the form. In that case, you need to suppress the errors decorator for the fields where it applies. Fortunately, there is a simple method for doing this. Assuming that the form element is represent by the variable $element, we can make the following call:
$element->removeDecorator('Errors');
The element in question will now not display any associated errors next to it.
Leave a Reply