I am working on a view to search based on multiple categories and want to hide the exposed filters for categories with no terms.
Normally when an exposed filter contains no terms it shows and -None- as the only two options which doesn't look nice. Is there any way to hide such exposed filters? and display them only when there are available options.
Comments
Comment #1
sunSorry, unfortunately this support request is way too specific. Please have a look at the issue queue - Views maintainers are buried already. You might want to try to get further support at http://drupal.org/support. Additionally, the answer to your question might be covered in the handbooks at http://drupal.org/handbook/modules/views already.
If you were able to solve this issue on your own in the meantime, you might want to add the involved steps to this closed issue, so other users searching for a similar solution might find it.
Comment #2
Xabi commented"Way too specific"? This is maybe the worst drawback of the Views module!
Comment #3
Xabi commentedComment #4
dawehneri bet you can solve this with creating your own hook_form_alter.
views module cannot do everything as you want, then some other people comes and also want to do it, but on another way.
Comment #5
Xabi commentedWell, I think that Views is, mainly, a module for filtering content. If you can't "filter the filters", the module become useless for the end user in a lot of situations. Think about a taxonomy "developers" applied to the site News, Downloads and Directory. If you build a "Downloads" View and expose a filter for "developers", you get all the developers from News, Downloads and Directory. And also, you get any developer term, even if it's empty (no nodes related). So you can do the filtering, and you will get nothing. This is the point: you are exposing useless combinations of terms.
So I'm talking of dinamically modify exposed filters to put them in context (in my example: expose a "developers" filter showing only developers associated with Downloads, and excluding "empty developers"). It don't seems "too specific", it seems a basic, logical feature in a module of this kind.
Here you have two different Views users asking for that. Do a search at the forums section and you will see a lot of users asking for the same thing. Do a search at this Issues section and you will find threads like this:
http://drupal.org/node/213820
Or this:
http://drupal.org/node/84124
And many more. So please, stop closing them as "fixed" or "won't fix": they are definitely not "too specific".
I don't know how to use hook_form_alter to get that functionality, by the way.
Comment #6
Xabi commentedComment #7
Xabi commentedComment #8
merlinofchaos commentedI'm sorry, your request isn't even possible to implement. Exposed filters are, by necessity, generated before teh content is ever seen. You want the content to modify the filters, but the filters are already created. You can't have your chicken before you have your egg.
This *is* won't fix.
Comment #9
momper commented@xabi ""Way too specific"? This is maybe the worst drawback of the Views module!"
i totally agree ...
Comment #10
Isostar commented+1 subscribe
I can also use this functionality
Comment #11
sachbearbeiter commentedwe sponsored a little bit http://drupal.org/project/views_hacks#views_filters_selective
maybe this sounds interesting for you ...
Comment #12
arkjoseph commentedLook into adding a relationship. Taxonomy: Term > Require relationship.
that should be it.!
Comment #13
dr.osd commentedSomebody found a solution to this task?
Comment #14
tigin öztürk commentedI couldn't find any way for this problem. Someone solved this?
Comment #15
marco85 commentedI have the same issue..and founded nothing on the web..please try to get a solution and explain to US
Comment #16
thomas1977 commentedWould indeed be very nice to have this functionality. I realize that merlinofchaos 6 years ago in #8 noted that due to technical limitations/reasons this wasn't possible. But how about today with D7 + a more modern Views module?
Please feel free to close this issue again and mark it as "Closed (won't fix)".
Best,
Thomas
Comment #17
thomas1977 commentedComment #18
sachbearbeiter commentedPlease have a look here:
https://www.drupal.org/project/views_selective_filters
https://www.drupal.org/project/views_dependent_filters
http://bouteillenicolas.com/expertise-drupal/views-ajax-dynamic-dependen... (I didn't read it ... only as an example of a Google search ...)
In general the filtering stuff seems to be really simple, but the use cases are in reality often totally specific (hierachical vs plain for example).
Another possibility is to use the Search API and Facet API. In old times Views and the Search API were using different url arguments - this made the interaction between the modules sometimes difficult, but maybe this has been already solved ...
Comment #19
benaboki commented1. Make exposed filter form visible as a block in the main views page
2. Go to your sub-page in views and remove the exposed filter from Filter Criteria in Views
3. Go to structure>block>exposed form: (name of exposed form) and tell it to "only display in listed pages then leave it blank
4. Install and enable Views Block Area: https://www.drupal.org/project/views_block_area
5. Go back to your view and Add the exposed filter block as an area within the header/footer of views
a. Go to the view that needs a block inside an area
b. Click on add next to header, footer or no result behavior
c. Select Global: Block area
d. Select the block that you want
e. After saving the view, the block will now be visible in the header or footer.
Comment #20
chris matthews commentedThe Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue