Issues

ZF-5849: rendering formErrors Decorator w/ no error messages

Issue Type: Improvement Created: 2009-02-20T04:29:37.000+0000 Last Updated: 2009-08-17T06:38:07.000+0000 Status: Resolved Fix version(s): Reporter: José Domingos Grieco (jdgrieco) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: Attachments: - zf-5849_patch.diff

Description

When I passed a empty array to formErrors in a view its generate '

<

ul>

'. I think it would be better if no text was displayed. This can be done if in formErrors method we do a size verification in $errors paramenter:

public function formErrors($errors, array $options = null)
{
    if (count($errors) > 0) {
         ...
    }
    return $html;
}

Comments

Posted by Carlton Gibson (carlton) on 2009-08-17T06:32:48.000+0000

Patch file to tests/Zend/Form/Decorator/FormErrorsTest.php

This introduces a test case for this "bug". The test passes with the code as is.

Lines 89-91 of library/Zend/Form/Decorator/FormErrors.php contain an empty() check that handles this already. (Not sure when it was introduced.)

Posted by Carlton Gibson (carlton) on 2009-08-17T06:35:17.000+0000

I built a test case for this (see patch) -- the test already passes (in trunk).

I don't know if this was added after the case was reported and when. (I noticed this at some point after 1.7 though.)

Posted by Carlton Gibson (carlton) on 2009-08-17T06:38:07.000+0000

This just needs to be confirmed and closed (I wasn't sure if I was allowed to do that.)--- there's a perfectly good test case that can be added too in the patch file.

Have you found an issue?

See the Overview section for more details.

Copyright

© 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.

Contacts