Exposed view filter is not rendered properly I have a view with a filter "Has taxonomy term", this filter is an exposed filter and is set to be a "Dropdown" and "Show Hierarchy"

The vocabulary has parents and children term (hierarchical). 

The filter works fine but the html tags of the select dropdown are incorrect. The parent terms should be wrapped in  instead of  (see image 2) 

Can I override this?



I trying to do it with hook_form_alter() but I see that the construction of the select itself is done by drupal_map_assoc() function. Then I see no way to do it? Can I put the value for '#options' in other way?

&lt;?php
  $form['undergraduate']['school_country'] = array(
    '#type' =&gt; 'select',
    '#options' =&gt; drupal_map_assoc(array(t('UK'), t('Other'))),
    '#title' =&gt; t('In what country is your college or university located?'),
  );
?&gt;
You could check if it is the top level (maybe by checking if it doesn't have a - at the start), and then add the attribute disabled (disabled="disabled")

You could also use this module: drupal.org/project/term_reference_tree. It has on option to only allow selection of the lowest term in the hierarchy. I used it on a site recently and it worked well.