How does one control select lists using form API ?

Posted by user363036 on Stack Overflow See other posts from Stack Overflow or by user363036
Published on 2010-06-14T02:17:59Z Indexed on 2010/06/14 2:22 UTC
Read the original article Hit count: 249

Filed under:
|
|

I know this is somewhat of a newb question but I am running into a deadline and 3 days of Drupal experience will just not cut it...

$form['gender'] = array('#type' => 'select', '#title' => t('Gender: *'), '#options' => array(t('Male'), t('Female')), '#required' => TRUE, '#weight' => 2, );

How do I assign values to select values ? For example Male -> 'm' and Female-> 'f'. Also how do I give the select box a default caption "please select gender..."

Thanks guys

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6