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

sun’s picture

Status: Active » Closed (won't fix)

Sorry, 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.

Xabi’s picture

"Way too specific"? This is maybe the worst drawback of the Views module!

Xabi’s picture

Status: Closed (won't fix) » Active
dawehner’s picture

Status: Active » Fixed

i 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.

Xabi’s picture

Version: 6.x-2.x-dev » 5.x-1.6
Component: exposed filters » User interface
Category: feature » support
Status: Active » Fixed

Well, 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.

Xabi’s picture

Category: support » feature
Status: Fixed » Active
Xabi’s picture

Version: 5.x-1.6 » 6.x-2.x-dev
Component: User interface » exposed filters
merlinofchaos’s picture

Version: 5.x-1.6 » 6.x-2.x-dev
Component: User interface » exposed filters
Category: support » feature
Status: Fixed » Closed (won't fix)

I'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.

momper’s picture

@xabi ""Way too specific"? This is maybe the worst drawback of the Views module!"

i totally agree ...

Isostar’s picture

+1 subscribe

I can also use this functionality

sachbearbeiter’s picture

we sponsored a little bit http://drupal.org/project/views_hacks#views_filters_selective

maybe this sounds interesting for you ...

arkjoseph’s picture

Look into adding a relationship. Taxonomy: Term > Require relationship.

that should be it.!

dr.osd’s picture

Somebody found a solution to this task?

tigin öztürk’s picture

Issue summary: View changes

I couldn't find any way for this problem. Someone solved this?

marco85’s picture

I have the same issue..and founded nothing on the web..please try to get a solution and explain to US

thomas1977’s picture

Would 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

thomas1977’s picture

Status: Closed (won't fix) » Active
sachbearbeiter’s picture

Please 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 ...

benaboki’s picture

1. 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.

chris matthews’s picture

Status: Active » Closed (outdated)

The 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