Form select type: setting default based on options' value So I've got this form:

$form['color'] = array(
        '#type' =&gt; 'select',
        '#title' =&gt; t('Kleur'),
        '#options' =&gt; array(
            0 =&gt; t('Wit'),
            1 =&gt; t('Geel'),
            2 =&gt; t('Groen'),
            3 =&gt; t('Rood'),
        ),
        '#default_value' =&gt; 'Rood',
  );


As expected, this doesn't currently set the default value to 'Rood'. How would I get it so that the default value can be accessed by it's value?

Note that this example shows the string 'Rood', but in practice it would be a variable string that is pulled from the database.

Thanks in advance!
Default value should point to key, not a value.

In your example, default_value should be as in below.

'#default_value' =&gt; 3,


Hope below link will help you.

https://www.drupal.org/node/240783#comment-1794710