How to disable the first option of select form element I created a custom module that contains a form with select element
I tried to disable the first option like this, but failed to get it work

'#options' =&gt; $terms,
                '#empty_option' =&gt; '- Select category -',
                '#empty_value' =&gt; 'none',
                '#disabled_values' =&gt; array('none'),


How could this be achieved without removing the option?
Drupal by default doesn't allow for this, so you'll need to do two things:


Override theme_select()
Create your own callback the create the options
Change the way you define your select options in your form definition


Overriding theme_select():

function THEME_select($variables) {
  $element = $variables['element'];
  element_set_attributes($element, array('id', 'name', 'size'));
  _form_set_class($element, array('form-select'));

  return '&lt;select' . drupal_attributes($element['#attributes']) . '&gt;' . custom_form_select_options($element) . '&lt;/select&gt;';
}


Create your own callback the create the options:

function custom_form_select_options($element, $choices = NULL) {
  if (!isset($choices)) {
    $choices = $element['#options'];
  }
  // array_key_exists() accommodates the rare event where $element['#value'] is NULL.
  // isset() fails in this situation.
  $value_valid = isset($element['#value']) || array_key_exists('#value', $element);
  $value_is_array = $value_valid &amp;&amp; is_array($element['#value']);
  $options = '';
  foreach ($choices as $key =&gt; $choice) {
    if (is_array($choice) &amp;&amp; !isset($choice['data'])) {
      $options .= '&lt;optgroup label="' . check_plain($key) . '"&gt;';
      $options .= form_select_options($element, $choice);
      $options .= '&lt;/optgroup&gt;';
    }
    elseif (is_object($choice)) {
      $options .= form_select_options($element, $choice-&gt;option);
    }
    else {
      $key = (string) $key;
      if ($value_valid &amp;&amp; (!$value_is_array &amp;&amp; (string) $element['#value'] === $key || ($value_is_array &amp;&amp; in_array($key, $element['#value'])))) {
        $selected = ' selected="selected"';
      }
      else {
        $selected = '';
      }
      $options .= '&lt;option value="' . check_plain($key) . '"' . $selected;
      if(is_array($choice) &amp;&amp; isset($choice['disabled']) &amp;&amp; $choice['disabled'])
      {
          $options .= ' disabled';
      }
      $choice = is_array($choice) &amp;&amp; isset($choice['data']) ? $choice['data'] : $choice;
      $options .= '&gt;' . check_plain($choice) . '&lt;/option&gt;';
    }
  }
  return $options;
}


Change the way you define your select options in your form definition. Turn the option into an array with two keys:


data: The display value of the element
disabled: A boolean indicating whether to disable the element


Example:

$form['select'] = array(
  '#title' =&gt; t('Pick something'),
  '#type' =&gt; 'select',
  '#options' =&gt; array(
    'yes' =&gt; array('data' =&gt; t('Yes'), 'disabled' =&gt; TRUE),
    'no' =&gt; t('No'),
  ),
);