Hi,

It doens't work with contextual filters is that by design?

tested 7.X -1.1, 1.2 en dev

greetz
Arjandew

UPDATE:
After some research i find this code on line 35 of views_autocomplete_filters.inc (version 7.x - 1.2)

$arguments[$k]['default_action'] = 'ignore';

I comment this line out and everything works fine. filters and contextual filters together! anybody know why this line is necessary

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vasike’s picture

Priority: Critical » Major
Status: Active » Postponed (maintainer needs more info)

Actually it should work "by design.
Could you please provide more info about your case?

What about this issue : #2317351: Arguments not passed to filter when exposed as Content Pane ?

Arjandew’s picture

Issue summary: View changes
vasike’s picture

#1871382-3: Autocomplete not taking arguments into account

This is the original isssue with the commit for this.

The autocomplete suggestions are the View (executed) results. So if we have some arguments / contextual filters with some settings other than "Display all values", probably there'll be no results or not the results we need.
So, actually, the autocomplete executes the view having ""Display all values" set for all arguments.

Does it make sense?

Arjandew’s picture

But you set a contextual filters with a reason.

I tested it with some use cases:

a normal view pages,
view embeded in a panels,
Filter form exposed as block,
Filter form not exposed as block.
a contextual filters with arguments set in panels,
a contextual filters display all results and with a default value.
a contextual filters with a default value set in views

I combined the test cases with normal filters,
on none of these testcases works a contextual filters, but when i remove the following line all the above testcases are working.

$arguments[$k]['default_action'] = 'ignore';
Arjandew’s picture

After more tests i see that it still doesn't work. default value in views for contextual filters are working but not if you use input on pane config

Arjandew’s picture

Conclusion it is not possible to limit the results off the autocomplete suggestion based on contextual filter input on panel pane config..

Arjandew’s picture

And found the problem it's working just fine you dont need to change any code.. the problem was 'expose form as block' if it is a yes it doesn't work when you change it to expose this form as block to no it work with contextual filters with input on pane config.

If anyone can confirm that contextual filter input on pane config with default value on the contextual filter = 'hide view' works but it stop working when you change expose form as block. this issue can be closed and we can open a new issue for the exposed block

thanks!

nvahalik’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
nvahalik’s picture

This patch adds the ability to use contextual filters as an option.

texas-bronius’s picture

@nvahalik's simple patch in #9 works for me in my case: autocomplete was blindly returning all matchable items, but patch limits it down to the View's purview as the user would expect.

## Use case

Before:
A user types a partial, a list of items would show, user would select one and click Apply, and no results found.

After:
A user types a partial, a smaller list of items shows, user selects any one of them and clicks Apply, and all records matching that field are returned.

vasike’s picture

Status: Postponed (maintainer needs more info) » Needs work

it seems the patch (#9) won't apply anymore.
@nvahalik: could you, please, reroll?
thank you

nvahalik’s picture

Rerolled on top of latest 7.x-1.x.

nvahalik’s picture

Status: Needs work » Needs review
vasike’s picture

Status: Needs review » Needs work

still not ready to be committed
We need an extra check for this setting for existing Views with autocomplete filters.

Notice: Undefined index: autocomplete_contextual in views_autocomplete_filter() (line 40 of /path_to_modules/views_autocomplete_filters/views_autocomplete_filters.inc).

So we need not to break somehow existing autocomplete filters.

nvahalik’s picture

nvahalik’s picture

Status: Needs work » Needs review
nayanalok’s picture

#9 worked for me

Patch provided works very well for contextual filters.

scottsawyer’s picture

This is still a problem in D8.

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #15 is RTBC for Drupal 7.

venugopp’s picture

Here is a similar patch for D8/9.

venugopp’s picture

FileSize
5.4 KB

Here is the updated D8/D9 patch for the latest version of the module(1.3)