Re: Your opinion about QuickForm2 API

From: Date: Mon, 16 Apr 2007 17:09:51 +0000
Subject: Re: Your opinion about QuickForm2 API
References: 1 2  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-46255@lists.php.net to get a copy of this message
Le 16 avr. 07 à 18:31, Gregory Beaver a écrit :
$g->text(array('name' => 'aText', 'size' => 50))
          ->validate['regex'] =  '/\w+/';
$g->select(array('name' => 'aSelect', 'options' => array()) $select = $g->select['aSelect']; // or $form->select['aSelect']; $select->options['another'] = 1; $select->validate['custom'] = 'is_numeric';
I like this as well. We have designed what I would call a low-level API for QuickForm. Built on top of that, it will be easier to add syntactic sugar like this at a later time. It's a bit like what jQuery and Prototype did to javascript DOM. PHP5 allows this, we should indeed use it to our advantage IMO (I need to convince Alexey though :) ).
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.
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 :) -- Bertrand Mansion Mamasam Work : http://www.mamasam.com Blog : http://golgote.freeflux.net

« previous php.pear.dev (#46255) next »