I have exposed filters in a block that affect a view in another block on the same page. Most of the exposed filters are supposed to be selective. I originally installed this module around Xmas and noticed that the selective filtering was working but on the initial load of the page it didn't get rid of the extra filter options, but when I selected something or hit the reset button it would give me the selective filter results I was looking for.

So, I just installed the latest dev and now I see something different but I think related to the same problem. Now, on initial load I get no filters to display or the reset button. If I change one of the filters to not be selective, then I can see at least that filter and the reset button. If I choose something or hit reset, then it brings up all selective filter options just like I was expecting in the beginning.

I feel like something is not happening on my initial page load that isn't correct. Any ideas?

Comments

johnlutz’s picture

Component:General» Views Filters Selective

Does anyone have a clue where I can look to troubleshoot this?

Basically I have selective filters that seem to work (that is only show the filters that apply to the results on the page) if I select one of the filter options or hit the reset button. But if I just go to the page and don't select anything or don't hit reset buton, the selective filters are just not showing up at all.

Please help...

infojunkie’s picture

What happens if the exposed filters and the view are displayed in a page, instead of two separate blocks? Do the restricted filters work better then?

johnlutz’s picture

It seems to work perfectly if it is in the page vs in the block. How can we fix this to work in the block as well? Thanks.

infojunkie’s picture

Can you please explain how you setup the view block and exposed form?

johnlutz’s picture

I believe I just changed the "Exposed form in block" to yes and put the block that it created in the left sidebar. I forgot to say that I do have other Views modules installed. Not sure if any would conflict.

Here is a list:
Better Exposed Filters (Best guess as what would be conflicting if any of these?)
DraggableViews
Views Bulk Operations
Views Custom Field
Views Slideshow

These are the Views Hack modules I have enabled:
Views Auto-refresh
Views Display Block Path
Views Filters Auto-submit
Views Filters Reset
Views Selective Exposed Filters
Views Type Block

johnlutz’s picture

I can pay anyone interested in helping me find a solution to this. Please help. Thanks.

johnlutz’s picture

After some more investigation, this only seems to mess up the selective filter when there is an argument. I have a taxonomy term id with depth argument that if I take it off, returns a selective filter in the block. As I stated earlier, this is a problem with the exposed filter in the block only. If it is in the page, it works correctly. Anyone?

johnlutz’s picture

Title:Initial load not working correctly for me» Selective Exposed Filter not working in exposed block when there is an argument

Changed the title because I think I have narrowed the issue down a bit more.

infojunkie’s picture

Does the argument specify that the view should return no results if the argument is empty?

johnlutz’s picture

Yes, Hide view / Page not found (404) if argument is not present.

infojunkie’s picture

So what is the difference in behaviour when you enable / disable selective filters?

johnlutz’s picture

If I have selective filters enabled, then I have the title of that exposed filter area display in the block and then the rest of the block and form is empty, has no fields showing up. Even the submit button is gone.

If I have selective filters disabled, then I see the title, the exposed field, and then a reset button. The exposed field shows every single term available for that taxonomy though, not just the ones that are used in the items being displayed.

johnlutz’s picture

The link I am providing is using this view. Right now, the top exposed filter has the selective option turned off. If you select one of the options, like "100% Polyester", you will see the other exposed filters show up. These have the selective filter turned on. For some reason they don't show up initially when the exposed filters are in a block.

The first exposed filter is showing every one of the terms in that taxonomy, whereas the some of other exposed filters (Manufacturer) have alot more terms inside their taxonomy that don't show up, because their aren't any products that use those terms, as they shouldn't show up. Problem is that these filters dont' show up initially for some reason.

http://siegelsuniforms.com/uniforms-apparel/uniform-types/class-uniforms

infojunkie’s picture

Thanks to johnlutz' effort to reproduce the problem in a vanilla Drupal environment, I was able to quickly find the problem. It occurs because Views uses two different instances of the view, one to render the exposed form in the block, and the other for the view results on the main page. The main page instance receives its arguments from the URL, while the exposed form instance receives no arguments.

Therefore, when Selective Filters executes the exposed form's view, which has no arguments, it finds zero results, since you set the argument to return no results if it's empty. Setting the argument to full results would not work correctly since it would return more results than the actual view on the page.

The solution is a bit complex since I need to pass the page's arguments to the exposed form instance of the view. Stay tuned :-)

infojunkie’s picture

Status:Active» Fixed

Fixed in the latest dev. Please try it (12 hours from now) and let me know.

johnlutz’s picture

This is working for me. Yeah!!! Thank you Karim for all your help. I will keep you posted if I see any issues.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

laraz’s picture

This patch has not worked for me.
I have a view, display in page, which displays a set of results that are filtered by the argument.
Then I want a filter taxonomy term "Exposed" field that the results of this only appear depending on the argument.

I supose that the module views_filters_selective make this.

infojunkie’s picture

@laraz, this is what Views Filters Selective is supposed to do. If it's not working for you, please open a new issue where you describe in detail (preferably with screenshots) your problem.

NIKS_Artreaktor’s picture

A part of this problem when create exposed filters by module in exposed form block

http://drupal.org/node/1387026

Please help with some advice.

Many thanks.

stefan81’s picture

Same with me, Selective Exposed Filter is not working when I have an argument in the view. Also on page views. Any idea how to solve this?

stefan81’s picture

Status:Closed (fixed)» Needs work
stefan81’s picture

Status:Needs work» Closed (fixed)

I am sorry, I had a custom php validator for my arguments in the view.
It was the source of my problem.
Views 3 had a build in solution for my php validator. by removing it, and upgrading to views 3, it works now.