Re: QuickForm: setDefaults on tricky group

From: Date: Thu, 17 Apr 2003 14:22:13 +0000
Subject: Re: QuickForm: setDefaults on tricky group
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4912@lists.php.net to get a copy of this message
<ckline@rightcode.net> wrote : > > On Thursday, April 17, 2003, at 09:47 AM, Bertrand Mansion wrote: > >> <ckline@rightcode.net> wrote : >> >>> >>> On Thursday, April 17, 2003, at 09:38 AM, Bertrand Mansion wrote: >>> >>>> <ckline@rightcode.net> wrote : >>>> >>>>> Hi all, >>>>> >>>>> I am trying to figure out how to get setDefaults to work on this >>>>> group. >>>>> >>>>> Here is me setting the default: >>>>> >>>>> $defaultValues['investigator1'] = >>>>> array('person'=>$default_peeps[0]); >>>>> >>>>> Here I define the options for the select: (this is what is causing >>>>> the >>>>> problem) >>>>> >>>>> $options = array('0' => 'Choose person') + $per_res; >>>>> >>>>> Here is the group: >>>>> >>>>> $investigator1[] = >>>>> &HTML_QuickForm::createElement('select','person', >>>>> '&nbsp;&nbsp;is a primary investigator?', $options); >>>>> $investigator1[] = &HTML_QuickForm::createElement('radio', >>>>> 'yesno', >>>>> 'Yes',null, 'Y'); >>>>> $investigator1[] = &HTML_QuickForm::createElement('radio', >>>>> 'yesno', >>>>> 'No', null, 'N'); >>>>> $res_p_edit_form->addGroup($investigator1, 'investigator1', >>>>> 'Person:', >>>>> ',&nbsp'); >>>>> >>>>> IF i remove the line where I set the value of $options and replace >>>>> $options with $per_res in my select, the setDefaults works fine. The >>>>> problem is that there are 5 of these groups, and I need to have a >>>>> Choose Person with a value of 0 for the options that are not >>>>> selected. >>>> >>>> Is your register_globals on or off ? >>>> >>>> >>> >>> register_globals are OFF >>> >>> is this the problem? >> >> No. Which version of QuickForm are you using ? >> >> > > $Id: QuickForm.php,v 1.58 2003/02/02 18:17:24 mansion Exp $ Can you try with at least QuickForm 2.10 or even better 3.0Beta1 ? Anyway, with a quick look at your code, I am not sure the problem is in QuickForm because the above code should work fine. Of course, it depends on what you have in $default_peeps[0], $per_res... As you don't provide these, I can't help more. Bertrand Mansion Mamasam

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