Re: HTML_QuickForm2: Get all errors of a form
| From: | Christian Weiske | Date: | Tue, 05 Jul 2011 09:00:25 +0000 |
| Subject: | Re: HTML_QuickForm2: Get all errors of a form | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31156@lists.php.net to get a copy of this message | ||
Hi again,
> When unit testing QF2 forms, it's sometime desirable to get a list of
> all error messages of a form. Is this possible without iterating
> through all elements and calling getError() on them?
Currently, in lack of a better approach, I do:
$form->validate();
foreach (new RecursiveIteratorIterator($form->getIterator()) as $elem) {
var_dump($elem->getId(), $elem->getError());
}
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-= Geeking around in the name of science since 1982 =-