Re: Quickform setSelected problem

From: Date: Thu, 29 Apr 2004 10:34:35 +0000
Subject: Re: Quickform setSelected problem
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12216@lists.php.net to get a copy of this message
<wfm@macscan.co.uk> wrote : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Hi, > > I am having some trouble trying to use the Quickform package to create > a multi-line select field, with several item selected. > > I have the following code: > > > $form->addElement('select','rid','',$rec,'MULTIPLE'); > > $rec is an array. So far this produces the correct HTML. > > However I would like to preselect some of the items in this box, but I > can't see how it works from using the PEAR manual. > > I am trying to use setSelected(), to do this by using the following > code: > > $form->seSelected($preselected); > > I have tried an array and a comma seperated list in preselected, but no > joy. I also tried to use setDefaults, but that did not work. > > Am I doing this completely wrong ? The PEAR manual does not provide any > examples, so I am a bit lost here. Hi, IIRC, you use setDefaults(array('rid' => array(1, 2, 4))); Bertrand Mansion Mamasam

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