[development] Array of fields on an admin settings form
Jeff Greenberg
jeff at ayendesigns.com
Fri Apr 30 16:57:41 UTC 2010
Hi. I have an admin settings form that contains an array of select
fields. The problem is that when submitted, the values don't end up in
the db and are the select fields go back to having no selected value.
The form was working fine as checkboxes, but when the need arose for
each label value to have multiple values to choose from (instead of
on/off) and I made it an array of fields, as below, it stopped working.
$results_tabs = array('' => 'None','a','b','c','d');
$form['myform']['form_text'] = array(
'#value' => t('Select a setting for each type'),
);
$form['myform']['myform_types'] = array('#tree' => 1);
foreach(myform_list_content_types() as $i => $type) {
$form['myform']['myform_types'][$type] = array(
'#type' => 'select',
'#title' => t($type),
'#options' => $results_tabs,
'#default_value' => $edit['myform']['myform_types'][$i]
);
}
return system_settings_form($form);
Jeff
More information about the development
mailing list