Re: QuickForm Controller default select values

From: Date: Tue, 28 Mar 2006 04:19:38 +0000
Subject: Re: QuickForm Controller default select values
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23464@lists.php.net to get a copy of this message
On 3/27/06, Timothy Marsolais <timothy@technology-works.net> wrote: > Hi Everyone, > > I know that we have been discussing this quite a bit lately, but I searched the archives, > google, > etc., and I am still having a problem. > > I made a wizard modeled after the state machine example, using Quickform controller. It works > great, > processes perfectly, and validates without a hitch. When I try load defaults to create an > update > process, the select elements will not show the default values while all the other fields show > the > defaults just fine. Is there a special trick for getting the select elements to pick up the > Default > values that I fed the controller object? > > I pulled the default values from a database, assigned the data to appropriately named > key=>value > pairs in an array ($defaults), and fed the $defaults array to the Controller using the > setDefaults() > method. All of the other fields work like a charm, but the select methods turn up with > nothing. > Are you perhaps trying to set the value to the label of the select rather than the value? $form->addElement('select', 'sel', 'Select', array('val' => 'Label')); $form->setDefaults(array('sel' => 'val')); -- Justin Patrin

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