By OptimusPrime23 on
Hi I'm using Drupal 6.18 I'm developing a module with forms.But i'm experiencing a problem with the display part of checkboxes and radio buttons.
Both of them do not display in my form i used the follwing code from the resource http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....
For Radios I used
$form['radio'] = array(
'#type' => 'radios',
'#title' => t('Gender'),
'#options' => array(t('Male'), t('Female')),
);
For checkboxes :
$form['chck'] = array(
'#type' => 'checkboxes',
'#title' => t('Default options'),
'#options' => array(
'status' => t('test1'),
'moderate' => t('test2'),
'promote' => t('test3'),
'sticky' => t('test4'),
'revision' => t('test5'),
),
'#description' => t('This is a test.'),
);
Comments
What function is this code
What function is this code in?
Do other form elements display correctly?
How is the form invoked?
Side note: When using '#options' is best to give the elements explicit keys and not rely on the default indexing of the array. That way if you re-arrange the options, the key values don't change.