Re: Re: Your opinion about QuickForm2 API

From: Date: Mon, 16 Apr 2007 17:09:30 +0000
Subject: Re: Re: Your opinion about QuickForm2 API
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27072@lists.php.net to get a copy of this message
And how would you define elements order? Luca On 4/16/07, Gregory Beaver <greg@chiaraquartet.net> wrote:
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 -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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