Re: QuickForm and select

From: Date: Thu, 07 Jul 2005 15:43:35 +0000
Subject: Re: QuickForm and select
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19894@lists.php.net to get a copy of this message
Gerard Bowe a écrit :
[...]
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-- the html version is <select name="select"> <option selected>--Choose One-- <option value="1">Room 01 ............. </select> Sorry about the confusions (1st post !!) ger Hello,
if I understood, I 've make it with loadDbResult. here is an example : $selenc=&$addform->createElement('select','id_encadrant','Encadrant responsable'); $selenc->addOption ('aucun','NULL'); // here is the element not in the database $selenc->loadDbResult($result,'nom','id_encadrant'); // $result is the result of an sql querry $addform->addElement($selenc); I hope that it's what you wants to do. Florent (sorry for my English)

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