Re: HTML_QuickForm
| From: | Bertrand Mansion | Date: | Mon, 21 Jan 2002 12:52:48 +0000 |
| Subject: | Re: HTML_QuickForm | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4016@lists.php.net to get a copy of this message | ||
Hi Brian,
<brian@onlineinfo.net> wrote :
> I was working with HTML_QuickForm and have made some minor changes. The
> problem I was having was when calling addElement(). Currently this method
> returns nothing and there is no reference to the object you have just
> created since it is appended to the end of the _elements array. I have
> modified it so that the array addElement() creates holds references to the
> new element object and this array is returned. Now I can access the object
> I have just created easily:
>
> $select = $form->addElement('select','id',null,'Choose');
> $select['object']->load(dbresult);
>
> I think users of HTML_QuickForm will find this useful.
Sure. Adam Daniel has written a getElement() method to achieve what you
want. It works like that :
$form->addElement('select', 'sel', 'Test Select:',
array('A'=>'A',
'B'=>'B'));
$select = &$form->getElement('sel');
$select->setSize(5);
$select->setMultiple(true);
As we are thinking about other great improvements in HTML_QuickForm, it
might still take some time before we commit that and the rest.
> The other thing I noticed was in HTML_QuickForm/Elements/select.php. When
> calling fetchRow() from loadDbResult(), it was checking to make sure
> fetchRow was returning an array. I have changed it so it checks if fetchRow
> returns a Pear error, then an array. If it is neither, it returns a new
> pear error.
This one has been committed. Thanks for your support.
Bertrand Mansion
Mamasam