1

I have created view page to find events from Start date - End date and category(taxonomy terms). I have enabled expose filter on fields. How do I show '-select-' instead of '-any-'

or else is there any other method to show no result until user does not add filter value?

enter image description here

2 Answers 2

2

To display Results Only when Criteria is selected :

  • In your view, change Advanced Settings -> Exposed form style to Input required

enter image description here

  • In Exposed Form style settings you could define the text to be displayed on no results

enter image description here

OR

To Alter Exposed form options:

  • You need to implement hook_form_alter()

  • Here is a sample code of it:

function mymodule_form_alter(&$form, &$form_state, $form_id) { 
    case 'views_exposed_form_id':
    $name = 'Vocabulary_name';    
    $myvoc = taxonomy_vocabulary_machine_name_load($name); 
  $tree = taxonomy_get_tree($myvoc->vid);     
    foreach ($tree as $term) {        
     $tax[$term->tid] = $term->name;  
    }     
    $form['field_taxonomy']['#options'] = $tax;  
}
1
  • thanks for your support, first method works perfectly for me. :) Dec 9, 2014 at 5:32
0

You can use Better Expose Filter Module and within Views -> Exposed Form Style ->Choose (Better Exposed Filter) now in BEF settings -> Display "tid" exposed filter as -> Select (Default Select List) -> Show More options for "tid_1" -> see (Override "Any" option label ) -> write (-Select- ) then save the view . This will change the to -Select- .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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