I'm trying to build a block that uses an exposed filter (Taxonomy: Term ID (with depth)) but whenever I navigate to the actual page where the view block is, and choose something from the exposed filter, I get this message:

Chrome: An error occurred while attempting to process /views/ajax: Cannot call method 'toLowerCase' of undefined
Firefox: An error occurred while attempting to process /views/ajax: a.tagName is undefined

The block had AJAX enabled, so I then disabled it, but now the exposed filter doesn't appear at all. I tried deleting the exposed filter, saving, then adding it back with AJAX still turned off, but whenever I go to the page containing that block, the exposed filter is not there. I also tried adding completely different exposed filters (published, node type) to see if it was just this specific filter. No dice. they don't show up on the page. I then went to a view that never had AJAX on, and exposed filters still won't show up. I've attached an export of my view. Any idea what's going on here? I can't seem to get an exposed filter to show up at all of AJAX is off, and if it's on, I get the above errors on submit.

I am running the Jan 4th Dev of Views and the Dev version of CTools. I think it's from the 3rd. Is there any way I can check what the specific date it's from?

** solution - please see http://drupal.org/node/1016574#comment-3938848 - blocks support exposed filters if Ajax is turned on.

CommentFileSizeAuthor
downloads_view.txt9.15 KBryan.armstrong

Comments

dawehner’s picture

Status: Active » Closed (duplicate)
ryan.armstrong’s picture

Title: Exposed Filters Giving an Error » Exposed Filters Not Showing Up

I'm reopening this issue as it seems it really was two separate issues. The AJAX one is being delt with at the link Dereine posted above. However, even with AJAX off, exposed filters are not working for me. They are simply not being rendered on the block, page, or even live preview display. If I turn AJAX on, they show up, but then I get the above error. I'm going to move up to the latest version of views and CTools today and test that, but if anyone has any ideas...

ryan.armstrong’s picture

Status: Closed (duplicate) » Active

Whoops, forgot to open it back up.

ryan.armstrong’s picture

Status: Active » Fixed

After upgrading to the latest CTools and Views, my old views still have the above issue, but any new views do not, and the exposed filter is showing up and working as intended. So I guess this is now foxed. I don't know why the old views don't work, but seeing as new ones do, I am going to mark this as fixed unless anyone else says otherwise.

ryan.armstrong’s picture

Status: Fixed » Active

Ok I spoke too soon. But I've nailed down where the problem is. When I went to do a new test after updating I went and just made a page view, but before in my old views I was making block views. In a page display, the exposed filter works just fine, it's in a block display that it doesn't appear, so apparently the code to render our the exposed filter is missing in the code that prints out a block display vs. the code that prints out a page display.

Update: I went through and tried using the 'exposed filter as block' option to see if that would make a difference, but it still doesn't show up. Absolutely nothing is rendering from that block, not even just an empty 'block-blockX' div. But I am now also getting this error message, which might be helpful:

Notice: Undefined property: view::$exposed_data in views_plugin_exposed_form_input_required->exposed_filter_applied() (line 42 of /var/www/pfab/public_html/sites/all/modules/views/plugins/views_plugin_exposed_form_input_required.inc).

duellj’s picture

Running the latest CVS checkout of both CTools and Views, I've got the same problem with exposed fields when AJAX is enabled. I get the same errors as in the original issue:

Chrome: An error occurred while attempting to process /views/ajax: Cannot call method 'toLowerCase' of undefined
Firefox: An error occurred while attempting to process /views/ajax: a.tagName is undefined

I tried removing my view and recreating fresh with the newest checkout, same problem.

The exposed filters show up fine when AJAX is disabled.

duellj’s picture

Status: Active » Closed (duplicate)

Nevermind, just saw that this is a duplicate, sorry :)

nvaken’s picture

Would be nice to have a link to the duplicate.

duellj’s picture

The duplicate issue is in the first comment: #1015960: Cannot call method 'toLowerCase' of undefined
I posted a patch over there that resolves this issue.

ryan.armstrong’s picture

Title: Exposed Filters Not Showing Up » Exposed Filters Not Showing Up in Block View
Status: Closed (duplicate) » Active

This issue was actually two issues, one with the toLowerCase part (which was fixed), the second being that exposed filters are not showing up in block displays. This isn't a duplicate issue anymore, as it is now only about the second issue, which is why I renamed it. Exposed filters are showing up in page displays, but not block displays.

Dereine: To avoid any confusion should I just open up a new issue?

merlinofchaos’s picture

Status: Active » Fixed

1) Don't open two issues in one issue.
2) Blocks don't support exposed filters unless AJAX is on.

ryan.armstrong’s picture

My apologies. At the time, I didn't know if they were two issues or not at as all I knew was that exposed filters were not working correctly. It became two issues later on, though as you have pointed out, the second bit wasn't actually an issue, but expected behavior. Thank you for the information regarding blocks, exposed filters, and AJAX.

Unless I missed it, I don't believe it states anywhere when creating an exposed filter in a block display or turning AJAX on in a block display that AJAX must be enabled in order for exposed filters to work. Seeing as this is not the case for page displays, it might be useful to place a message when creating an exposed filter reminding the user that AJAX must be enabled.

Status: Fixed » Closed (fixed)

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

zach.bimson’s picture

Status: Closed (fixed) » Active

Im still experiencing this issue with exposed filters, has anyone fixed it?
If i turn AJAX ON they appear but dont actually work...

giorgio79’s picture

Thanks Merlin, this info was key

Blocks don't support exposed filters unless AJAX is on.

Perhaps some kind of warning for the users would be welcome if they try to use an exposed filer on non ajax block view:)

mrded’s picture

#11 Haha, very elegant solution :)

scrubba’s picture

I have the same problem as #14 above
If no ajax, the exposed filter does not appear in the block
but some content does display (when block inserted into a page)
In view display preview there is no filter..

When I turn ajax on
I see in the view display preview that the exposed filter does appear and works.
But When i Insert the block into a regular node
Both the filter and content are missing
In fact The whole block fails to display

skyredwang’s picture

Status: Active » Postponed (maintainer needs more info)

Could #14 or #17 provide a way to produce the problem?

vedpareek’s picture

Hi
I also faced this problem. show exposed filter block on Block.
I also on ajax in view then exposed filter block show on block. But when I submit the filter value then Result block is not display.
So for solve this problem I wrote form_alter in custom module.
if($form_state['view']->name == "Name of view" && $form_state['view']->current_display == "Name of current display"){
$form_state['view']->use_ajax = 0;
$form['#action'] = "action url where both block is display";
}

This code is working fine for me..

Thanks

bwoods’s picture

I can confirm that #19 works. Thanks!

Depending on the complexity of your site, you may also want to include an isset for $form_state['view'] before the listed if statement.

madhusudan’s picture

In my case its reverse.
its showing in blocks and master view, but not in page view!

I even tried with fresh installation where minimal modules were installed, and tried changing themes,
then also same problem!.

using 7.x-3.7 stable ver

madhusudan’s picture

Issue summary: View changes

I want to save time for others so I have updated the issue.

rodrigoaguilera’s picture

Category: Bug report » Feature request
Status: Postponed (maintainer needs more info) » Needs work

What about giving a warning if the display is a block display with exposed filters to enable ajax if its off?
I think is the only solution for this.

Does it affect drupal 8?

piyushbagri’s picture

I have face same issue.
When I disable show query in views setting it start appearing.

pganore1@gmail.com’s picture

This issue is driving me nuts, I went ahead to debug and found that the views display type block, does not inherit the exposed options in form to work with the exposed pagination.
More specifically:

[FILE] views_plugin_pager_full.inc
[FUNCTION] exposed_form_alter(&$form, &$form_state)
the $form[#info] is empty the other form elements are missing thus it does not have anything to work with
When it hits my custom alter it just skips ahead
-- If you guys have a solution let me know.

BTW, this works perfectly for other view displays like page and content pane.

Also found that the Custom PHP field is causing some issues here too.

pganore1@gmail.com’s picture

Turns out it needed patching views_php (if you are using it).

alberto56 made a commit for views_php here:
https://www.drupal.org/node/2123315
https://www.drupal.org/files/issues/views_php-paging-2123315-97.patch

blogers’s picture

Very big problem and no fix ?=(

summit’s picture

see post #25, that's a fix right? Greetings, Martijn

Tronux’s picture

Same issue in the Drupal 8 version of Views, exposed filters don't show in a view-block. Turning on Ajax does return the filter however, you need to use Ajax -_-