Re: Getting all errors in HTML_QuickForm

From: Date: Thu, 02 Aug 2007 14:17:19 +0000
Subject: Re: Getting all errors in HTML_QuickForm
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27787@lists.php.net to get a copy of this message
Hi, Chris Boget wrote:
Is there a way to get all the errors generated upon submission all
at
once? I know you can use getElementError() but unless I iterated through all the elements calling that function (not ideal), I can't see any other way to get all the errors. Any pointers would be greatly appreciated.
HTML_QuickForm is sooo PHP4:
Well, 2 comments about this:
As Christian and Justin already mentioned, you misunderstood my comment, I only meant that you can access "private" properties if you want to.
* Presumably HTML_QuickForm2 behaves identically (or nearly identically) to HTML_QuickForm since HTML_QuickForm2 is just a PHP5 rewrite. Am I wrong about this?
It is a rewrite from scratch, so the API may be quite a bit different. OTOH, it uses PHP5 new features, so iterating over all elements will be pretty straightforward: foreach ($form->getRecursiveIterator() as $element) { // store the element's error }
* HTML_QuickForm2 has virtually NO documentation. Whether or not I am right regarding the point above, I felt it would be better for me to learn HTML_QuickForm first as it has documentation, examples and tutorials. So if I was right, it would be easy enough to switch. If I was wrong, I wouldn't be wasting a ton of time beating my head against the wall trying to figure something out, only for it to end up being me doing something horribly wrong because it was so poorly documented.
It doesn't have documentation because it is only 0.1.0-alpha and the API isn't stable yet. Wait until at least beta if you want end-user docs... HTML_QuickForm2 is certainly unusable in any production environment until (server-side) validation and renderers are there (that'll be a couple more releases). The "deprecated" message is mostly shown to prevent feature requests for HTML_QuickForm that aren't going to be implemented at this point of its life cycle, though as Christian said, its wording may be improved.

« previous php.pear.general (#27787) next »