I am using Zend Framework. For a particular form, there is not enough space to show the errors next to the form elements. Instead, I want to be able to display the errors above the form. I imagine I can accomplish this by passing $form->getErrorMessages() to the view but how do I disable error messages from being shown be each element?
I am using Zend Framework. For a particular form, there is not enough space
Share
You can add decorators to form elements using
setElementDecorators.Zend_Formhas a function called just afterinitentitledloadDefaultDecorators. In your subclass, you can override this like so:Assuming you added your elements in
init, that applies those decorators to each element in the form. You’ll note the absence of the “Errors” decorator insetElementDecorators. You could also try looping through the form elements and usingremoveDecoratorto remove just the Errors decorator.