Re: Re: Your opinion about QuickForm2 API
| From: | Luca Giandoso | Date: | Mon, 16 Apr 2007 17:35:28 +0000 |
| Subject: | Re: Re: Your opinion about QuickForm2 API | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-46258@lists.php.net to get a copy of this message | ||
I thought that with Bertrand's way it was more difficult for you to
implement elements order, but if it is not, that's ok.
Luca
On 4/16/07, Gregory Beaver <greg@chiaraquartet.net> wrote:
Bertrand Mansion wrote:At the moment, I have no idea how to do that, any ideas would be welcome. The good news is that QuickForm2 should be faster than current QuickForm :) Hi Bertrand, I would store element validation information in a simple array, and then use the renderer to render a PHP-based template (a la Savant) that will allow setting default values, so that the display process is basically: <?php $form->prepareCache(); include $form->getCacheFile(); ?> Validation would work as it currently does. You'd end up with something like: <?php $form = new HTML_Quickform2; $form['name'] = 'whatever'; if ($form->submitted && $form->valid) { } if ($form->cached) {Another feature request I've had that may be possible is to integrate some kind of forms creation cache, so that the form need only be created programmatically once, and then it can on subsequent requests be quickly recreated from a disk or database cache, skipping all the expensive method calls, but this is a separate question than the one you asked, let me know if you'd like a feature request opened on this.$form->displayCache();} else { // set up the form } ?> Things like validation errors can be handled with placeholders as well (an if() in the template that skips the error HTML). Greg -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php