Having a strange issue. I have created an attachment for a view, which is for the moment simply a clone of the standard view. However, if contextual or exposed filters are inherited, the attachment automatically displays the empty text. If I remove the ability to inherit filters, the attachment displays, but then of course the exposed filters no longer work to filter the results. Not sure really what I'm doing wrong here, as I never had this issue with Drupal 6. If anyone has any tips on what I could be doing wrong here, it would be appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NathanM’s picture

After playing around with filters for some time, it seems that this only happens when one of the exposed filters is an "autocomplete" taxonomy term reference field. If it is a dropdown field, it filters fine and the attachment displays as expected.

filburt’s picture

Same problem here...

Thanks for support!

Greetings
Filburt

gnal’s picture

Same here, exposed filter with autocomplete field breaks the attachment.

geraud’s picture

Same problem. Autocomplete exposed filter makes attachment view disappear.
Subscribe.

amirhosseinR’s picture

tnx geraud :)

NathanM’s picture

Category: support » bug
Issue tags: +views, +exposed filters, +inherit exposed filters, +views 3 exposed filters

As this has been confirmed by several people, can we change this to a bug report?

prosk’s picture

Please i have the same issue.

I confirm that when you choose autocomplete for a taxonomy field, you can't inherit filters from a page to an attached block.

Need help on that !

Thanks a lot

Countzero’s picture

Title: Inherit exposed filters is enabled, but attachment won't display. » Inherit exposed filters is enabled, but attachment won't display when using autocomplete widget.

Stumbled on this too, and it's very annoying. Also changing the title to reflect the infos provided.

Countzero’s picture

Version: 7.x-3.1 » 7.x-3.x-dev

Changing Version to dev.

Also see : http://drupal.org/node/1026436

Possibly useful info :

- The preview seems to work well, so it's probably not SQL related.
- Setting a value for the exposed Taoxnomy term or not doesn't change anything : even an empty value breaks the attachment.
- To be more precise, the attachment DOES show, but returns No Result.
- The behaviour of autocomplete fields seems to be OK otherwise, in exposed filters or elsewhere.

Hope it can help to debug this.

fearlsgroove’s picture

Issue summary: View changes

** edit ** nevermind ...

menelai’s picture

Here is the solution that helped me:
You should remove the autocomplete exposed filter in the attachment and make a contextual filter instead of it. For example, in the main view there is an exposed filter called "has taxonomy term with depth" provided with "term_node_tid_depth" variable.
Add contextual filter to the attachment: "has taxonomy term with depth". Set the same depth as on the main view. Choose "provide default value" as php-code:

$name = isset($_GET['term_node_tid_depth']) && !empty($_GET['term_node_tid_depth']) ? $_GET['term_node_tid_depth'] : 'all';
$name = preg_replace('/^"(.*)"$/', '$1', $name);
$name = str_replace('""', '"', $name);
return $name;

Then specify validation criteria: taxonomy term, your vocabulary and term id converted from name.

PROFIT

redsky’s picture

As noted in https://www.drupal.org/node/1026436, I had this problem in views-7.x-3.10. I think these two bug reports are about the same issue. I'm not sure of the procedure for updating/closing a duplicate or marking the version from dev (noted two years ago) or 7.x-3.10 noted today.

Oliver Huynh’s picture

Status: Active » Needs review
FileSize
758 bytes

Hi guys,

Here is the patch for this mysterious bug. Spend a while for investigating until I see the cloned views in wrong.
Not sure where it is wrong so it's better to get a fresh new views.

Status: Needs review » Needs work

The last submitted patch, 13: views.attachment.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Oliver Huynh’s picture

Simon Georges’s picture

Status: Needs work » Reviewed & tested by the community

I had the exact same bug (attachment not displaying because of a taxonomy exposed filter with autocomplete), and this patch fixed it… Thanks a lot!
I'm changing the status just to move things along about it.

tisteegz’s picture

Had this exact issue with drupal 7.59 and views 7.x-3.20. Couldn't apply the patch but changed it manually and it all works fine now. Would be great to get this in a release.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: views.attachment.patch, failed testing. View results

seattlehimay’s picture

Thank you for this patch! I have a complicated view (that does *NOT* have an autocomplete field, but does have many inherited filters) and my attachment was getting 0 results. After the patch things work correctly. I'm using Drupal 7.65 and Views 7.x-3.22.

FeyP’s picture

@seattlehimay @tisteegz Could you please check, if #3040497: [Regression] Missing JOIN in attached display with taxonomy filter and inherited exposed filter fixes your issue as well? It's already in the 7.x-3.x-dev version, so you could either try that or apply the patch from the issue. This is especially likely to fix the issue, if you don't have an autocomplete and are using 7.x-3.22 like @seattlehimay.

If the patch won't fix it, we're probably missing another property in views_clone(), that we should unset, but don't. In that case it would really help us, if you could export your view and attach it here so that we can look into it more closely. Thank you for your help.

FeyP’s picture

seattlehimay’s picture

@FeyP - I just tried the dev version of views on my test site, and it *DID* indeed fix the problem (complicated view, attachment with inherited filters that was previously displaying only in preview but not live on site). Thank you!!

FeyP’s picture

@seattlehimay Thank you for testing the dev release and for confirming that it works in the latest dev. That's great!

@all It would still be helpful to know, whether the latest dev release or the patch I posted earlier resolves the problem for someone, who has the original problem with the autocomplete. If it doesn't work, we need an export of a broken view to investigate further. If any of you could give it a shot, that would be appreciated.