ZF-6269: Errors decorator on Zend_Form

Issue Type: Bug Created: 2009-04-10T17:33:18.000+0000 Last Updated: 2009-11-19T12:57:35.000+0000 Status: Resolved Fix version(s): Reporter: Giuliano Riccio (cosmo87rg) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: - ZF-3242



Adding an Errors decorator to Zend_Form throws an error if any element of the form is not valid and no errors are set for the form.

<pre class="highlight"><?php
require_once 'Zend/Loader.php';

$oEmail = new Zend_Form_Element_Text('email');
    ->addValidator('EmailAddress', true)

$oForm = new Zend_Form();
    ->addDecorator('Errors', array('placement' => Zend_Form_Decorator_Abstract::PREPEND))

$oForm->isValid(array('email' => 'foo'));
$oForm->addErrors(array('Sign up failed')); // Without this throws an error

echo $oForm->render(new Zend_View());


Posted by Steve Hollis (stevehollis) on 2009-11-19T12:57:34.000+0000

The 'Errors' decorator (Zend_Form_Decorator_Errors) is designed for use with form elements whilst the 'FormErrors' (Zend_Form_Decorator_FormErrors) decorator is designed for use with whole forms.

You can use one or other or both, but the right decorator must be applied to the right object type.

See docs:…

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.