Re: QuickForm: setValue with select elements

From: Date: Thu, 10 Nov 2005 17:44:28 +0000
Subject: Re: QuickForm: setValue with select elements
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21875@lists.php.net to get a copy of this message
On 11/10/05, Damien Cros <damienc@cc.in2p3.fr> wrote: > Hi, > > I can't find the right way to use setValue with a select element. > > $options = array(1=>'yes', 2=>'no'); > $myselect = $form->addElement ('select', 'myselect', '', > NULL); > $myselect->setValue($options); > > doesn't work. > > but > > $myvalue = "thing"; > $mytext = $form->addElement('text', 'mytext', ''); > $mytext->setValue($myvalue); > > does. > > What should I do? > setValue is generally not that great to use. Search the ML archives for more. Use $form->setDefaults() instead. -- Justin Patrin

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