Re: QuickForm and select
| From: | Maximillian Schwanekamp | Date: | Thu, 07 Jul 2005 08:34:33 +0000 |
| Subject: | Re: QuickForm and select | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12798@lists.php.net to get a copy of this message | ||
Gerard Bowe wrote:
> Sorry, should of said I'm using HTML_QuickForm and population the select
> with a database result array ($offices);
>
> $obj_form->addElement('select', 'office', 'Office: ',
> $offices);
>
> The first row of the array is automatically selected. What I would like
> to do is add an empty "row" so that the select tag shows --Choose One--
Probably the easiest is to use the Element method addOption prior to
loading the database array values. E.g.
$ofc =& $obj_form->createElement('select', 'office',
'Office:');
$ofc->addOption('--Choose One--','');
$ofc->loadArray($offices);
--
Max Schwanekamp
http://www.neptunewebworks.com/