how to get all options values of simple hierarchical select in drupal $form? i have writed this code to unset empty terms : 

    function shs_selective_form_alter(&amp;$form, &amp;$form_state, $form_id) {  

  if ($form_id == 'views_exposed_form' &amp;&amp; $form['#id'] == 'views-exposed-form-projet-immobilier-page-1') {            
    foreach ($form['field_r_t_tid']['#options'] as $tid =&gt; $term_name) {
      if (is_numeric($tid)) {
        $result_count = db_select('taxonomy_index', 'ti')
        -&gt;fields('ti')
        -&gt;condition('ti.tid', $tid, '=')
        -&gt;execute()
        -&gt;rowCount();

        // Removing the option for tags with no-content
        if (!$result_count) {
          unset($form['field_r_t_tid']['#options'][$tid]);
        }                
      }
    }

  }
}


but is not worked, he show me this error : Undefined index : #options ...
how can i resolve this error?
In Drupal 7 you can use field_info_field(), while in Drupal 6 you can use content_field_instance_read(), which is defined in the CCK module.

You can also use list_allowed_values().

$field = field_info_field('field_name');
$allowed_values = list_allowed_values($field);