Re: QuickForm: setDefaults on tricky group

From: Date: Mon, 21 Apr 2003 20:48:22 +0000
Subject: Re: QuickForm: setDefaults on tricky group
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-4983@lists.php.net to get a copy of this message
On Thursday, April 17, 2003, at 10:22 AM, Bertrand Mansion wrote:
<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
I updated to the latest version 3.0 beta and all works as it should - thanks again. - Charles

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