[SMARTY] Re: [PEAR] QuickForm and select

Maximillian Schwanekamp <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
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/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.