
Using #options attribute attribute in elements like textfield and textarea will lead to unexpected behavior. The element will be rendered as usual, but trying to input any text except for a key from options array will result in 'An illegal choice has been detected. Please contact the site administrator.' error.
Example:
$form['options_test'] = array(
'#type' => 'textarea',
'#title' => t('Options test'),
'#options' => array('first' => 'First', 'second' => 'second'),
'#description' => t('Textarea to test #options behavior'),
'#default_value' => variable_get('options_test', '')
);
The resulting area will accept values first (not First) and second.
Comments