QuickForm: setDefaults on tricky group
| From: | Charles Kline | Date: | Thu, 17 Apr 2003 13:11:34 +0000 |
| Subject: | QuickForm: setDefaults on tricky group | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4907@lists.php.net to get a copy of this message | ||
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.
Any help would be appreciated,
- Charles