Re: QuickForm: setDefaults on tricky group
| From: | Bertrand Mansion | Date: | Thu, 17 Apr 2003 13:47:55 +0000 |
| Subject: | Re: QuickForm: setDefaults on tricky group | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4910@lists.php.net to get a copy of this message | ||
<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',
>>> ' 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:',
>>> ', ');
>>>
>>> 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 ?
Bertrand Mansion
Mamasam