I have a simple view outputting node in row style nodes.
It has 3 filters: node type, node published, and a date field. The date field is exposed, has a granularity "year".


SELECT field_data_field_lettre_date.field_lettre_date_value AS field_data_field_lettre_date_field_lettre_date_value, node.nid AS nid
{node} node
LEFT JOIN {field_data_field_lettre_date} field_data_field_lettre_date ON node.nid = field_data_field_lettre_date.entity_id AND (field_data_field_lettre_date.entity_type = :views_join_condition_0 AND field_data_field_lettre_date.deleted = :views_join_condition_1)
WHERE (( (node.type IN  ('lettre_aux_actionnaires')) AND (node.status = '1') AND (DATE_FORMAT(STR_TO_DATE(field_data_field_lettre_date.field_lettre_date_value, '%Y-%m-%dT%T'), '%Y') = '2011') ))
ORDER BY field_data_field_lettre_date_field_lettre_date_value DESC


On the display page, everything works fine. The filter is displayed and the view filtered. On the display block, nothing is display, neither the filters nor the nodes.
If on the block display I change the filter to not be exposed it works again, and outputs nodes.

#22 patch_views_exposed_filter_block_warn_users_19.patch992 bytespenyaskito
PASSED: [[SimpleTest]]: [MySQL] 1,336 pass(es). View
#19 patch_views_exposed_filter_block_warn_users_19.patch989 bytesmkadin
PASSED: [[SimpleTest]]: [MySQL] 1,311 pass(es). View
#1 view.txt16 KB_nolocation
Members fund testing for the Drupal project. Drupal Association Learn more


_nolocation’s picture

16 KB

attached the view where this is happening.

gagarine’s picture

Title: View exposed filter on Date Field not outputted in block display. » View (block display) having a exposed filter on Date Field don't show anything
Priority: Normal » Major
Issue tags: +#views

Is not only content of the bloc, but they are absolutely not output of the bloc at all.

KarenS’s picture

Title: View (block display) having a exposed filter on Date Field don't show anything » Exposed filters don't display on blocks

It looks to me like no exposed filter shows up on any block. I added a taxonomy exposed filter and it does not show up on the block either. I can't see any setting in the view to alter this behavior. Maybe this is by design.

Not showing content is probably because of whatever you have as your default settings for the filter. Since you can't change the value you have whatever the default is.

Moving this to the Views module queue to see if it is intentional that there would be no exposed filters on blocks.

KarenS’s picture

Project: Date » Views
Version: 7.x-2.x-dev » 7.x-3.x-dev
Component: Views Filter » block displays

Try again to move this issue....

esmerel’s picture

Category: bug » support
Priority: Major » Normal
Status: Active » Fixed
Issue tags: -#views

Is AJAX turned on? Exposed filters in blocks need it to work.

KarenS’s picture

That was the problem. That is totally non-intuitive. There is not a clue where you mark the filter to expose it that it won't show up in a block unless you set ajax on. Even if you are configuring the filter in the block display. Neither the filter nor the Ajax configuration tell you there is a connection between the two.

If you guys think that is OK, I won't belabor the point.

Status: Fixed » Closed (fixed)

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

gagarine’s picture

Title: Exposed filters don't display on blocks » Exposed filters don't display on blocks if ajax is off
Category: support » bug
Priority: Normal » Minor
Status: Closed (fixed) » Active

I think we should keep it open. How the hell users can know about it?

- we can switch on (without the possibility to put it off) automatically
- we can display an info message

merlinofchaos’s picture

Status: Active » Closed (works as designed)

This is the correct behavior.

blocks do not have URL paths; exposed filters need a URL path. If the exposed filter were to display (without AJAX) it would lead you to the front page. This is not desired.

MBroberg’s picture

I got tripped up by this too. A notice would be nice. +1 for a little info message in the filter section...

gagarine’s picture

Title: Exposed filters don't display on blocks if ajax is off » Warn than exposed filters don't display on blocks if ajax is off.
Status: Closed (works as designed) » Active

I know this is the correct behaviors but we can warn user. Please read #8.

dawehner’s picture

Component: block displays » Documentation
Category: bug » task

Seems to be a task

ximo’s picture

Priority: Minor » Normal

It's worth mentioning that it's not only blocks that require AJAX for exposed filters to work. Entity content (provided by the EVA module) is one example, and it took me a while to figure that out.

This is really a usability flaw, there's no way the user would know that AJAX is required for non-Page displays. A short text within the Views UI would be great, ideally below the "Expose this filter" checkbox as well as on the "Exposed form style" form. And only shown on relevant displays.

laroccadahouse’s picture


this issue saved my computer from the detrimental harm I was about to cause it.

Crell’s picture

I was just confused by this as well, even though I've run into it before and should have remembered it. :-) UI documentation here is needed.

dawehner’s picture

Issue tags: +Novice

Let's mark this as documentation task

You can use for that
You can use $display->handler->uses_exposed() to check whether the current display has exposed forms or not and display the help text based on that. Maybe some additions to advanced help would be cool as well.

jvns’s picture

Title: Warn than exposed filters don't display on blocks if ajax is off. » Warn that exposed filters don't display on blocks if ajax is off.
simonruffle’s picture

This issue wasted a couple of hours of my time. There is no indication of this "feature" and only this set of postings saved me. What also would have been useful to know is that you "turn AJAX on" under advanced settings

mkadin’s picture

989 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,311 pass(es). View

Here's a patch...not sure if this is the best methodology...

mkadin’s picture

Status: Active » Needs review
tim.plunkett’s picture

Triggering the testbot.

penyaskito’s picture

Status: Needs review » Needs work
992 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,336 pass(es). View
+++ b/plugins/views_plugin_display_block.incundefined
@@ -179,14 +179,17 @@ class views_plugin_display_block extends views_plugin_display {
+      if (parent::uses_exposed()) {
+        drupal_set_message('For block views, "Use AJAX" must be set to "Yes" for exposed filters to be displayed.','error',FALSE);
+      }

Needs t(). Updating patch.

UPDATED: Just read Gabor's "Do not reuse a string already run through t() for watchdog() and drupal_set_message()".
Ignore the attached patch.

penyaskito’s picture

Triggering the testbot.

yeaha’s picture

Status: Needs work » Needs review

thank you @ simonruffle ! also couldn't find the "turn ajax on button" at first

esmerel’s picture

Status: Needs review » Fixed

Commited to 7.x-3.x

Status: Fixed » Closed (fixed)
Issue tags: -Novice

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