Re: Your opinion about QuickForm2 API

From: Date: Mon, 16 Apr 2007 17:02:57 +0000
Subject: Re: Your opinion about QuickForm2 API
References: 1  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-46254@lists.php.net to get a copy of this message
Hi again, As an addendum to my last message, I just thought of an even clearer interface: <?php $form = new HTML_Quickform2; $g = $form->group['mygroup']; $g->text['aText'] = array('size' => 50); $g->select['aSelect'] = array('size' => 5', 'options' => array(...)); ?> By using ArrayAccess offsetSet() you can put the element name in brackets. This way, the same procedure (array access) is used to both set and to retrieve elements. This could also be used to modify values later if necessary, for the same element, something that I've found exceedingly difficult to do in the current QF. Consider the following: <?php $form = new HTML_Quickform2; $form->text['mytext'] = array('default' => 'whatever'); unset($form->text['mytext']); ?> Simple and easy. Greg

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