I built a module that creates a form and let the user to add a variable called unit
into database. Now this unit
should be the options
of select list of a content type. the form id of the content type is phone_book_node_form
, but the problem is I can't add options to the select list. this is the firebug output of the form (content type)
the name of the select list field is field_phone_yegan
. I tried this function in template.php
function MYTHEME_form_alter(&$form, &$form_state, $form_id){
switch ($form_id){
case 'phone_book_node_form':
$form['field_phone_yegan'] = array(
'#options' => array('yes'=>t('yes'),'no'=>t('no'))
);
break;
}
}
nut nothing was added to the select list. I also tested
$form['edit-field-phone-yegan-und'] = array(
'#options' => array('yes'=>t('yes'),'no'=>t('no'))
);
$form['field_phone_yegan[und]'] = array(
'#options' => array('yes'=>t('yes'),'no'=>t('no'))
);
but it didn't work. How do I can add options to this content type select list?