I have two exposed filters Contry (name=field_country_tag_tid) and City (name=field_country_tag_tid_option_limit). Reference limit option Module limet avaliale options in city but not when page with filters loaded at first time. That why I wanted to desable City Filter by using #states

function mymodue_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'map') {
   $form['field_country_tag_tid_option_limit']['#states'] = array(
  'visible' => array('select[name="field_country_tag_tid"]' => array('value' => '1')),


I used the following example http://api.drupal.org/api/examples/form_example!form_example_states.inc/function/form_example_states_form/7

But there are no any changes in my exposed filter, where is my mistake? Thanks

  • I tried to use "id" instead of "name" and now it works!:) – moto Oct 22 '12 at 17:52
  • put your solution as an answer and check it so others may see the solution. Comments are not visible as answer. – junedkazi Oct 22 '12 at 18:24

I tried to use id instead of name and now it works!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.