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.
| Comment | File | Size | Author |
|---|---|---|---|
| downloads_view.txt | 9.15 KB | ryan.armstrong |
Comments
Comment #1
dawehner#1015960: Cannot call method 'toLowerCase' of undefined
Comment #2
ryan.armstrong commentedI'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...
Comment #3
ryan.armstrong commentedWhoops, forgot to open it back up.
Comment #4
ryan.armstrong commentedAfter 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.
Comment #5
ryan.armstrong commentedOk 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).
Comment #6
duellj commentedRunning 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:
I tried removing my view and recreating fresh with the newest checkout, same problem.
The exposed filters show up fine when AJAX is disabled.
Comment #7
duellj commentedNevermind, just saw that this is a duplicate, sorry :)
Comment #8
nvakenWould be nice to have a link to the duplicate.
Comment #9
duellj commentedThe duplicate issue is in the first comment: #1015960: Cannot call method 'toLowerCase' of undefined
I posted a patch over there that resolves this issue.
Comment #10
ryan.armstrong commentedThis 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?
Comment #11
merlinofchaos commented1) Don't open two issues in one issue.
2) Blocks don't support exposed filters unless AJAX is on.
Comment #12
ryan.armstrong commentedMy 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.
Comment #14
zach.bimson commentedIm still experiencing this issue with exposed filters, has anyone fixed it?
If i turn AJAX ON they appear but dont actually work...
Comment #15
giorgio79 commentedThanks Merlin, this info was key
Perhaps some kind of warning for the users would be welcome if they try to use an exposed filer on non ajax block view:)
Comment #16
mrded commented#11 Haha, very elegant solution :)
Comment #17
scrubba commentedI 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
Comment #18
skyredwangCould #14 or #17 provide a way to produce the problem?
Comment #19
vedpareek commentedHi
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
Comment #20
bwoods commentedI 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.
Comment #21
madhusudan commentedIn 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
Comment #21.0
madhusudan commentedI want to save time for others so I have updated the issue.
Comment #22
rodrigoaguileraWhat 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?
Comment #23
piyushbagri commentedI have face same issue.
When I disable show query in views setting it start appearing.
Comment #24
pganore1@gmail.com commentedThis 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.
Comment #25
pganore1@gmail.com commentedTurns 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
Comment #26
blogers commentedVery big problem and no fix ?=(
Comment #27
summit commentedsee post #25, that's a fix right? Greetings, Martijn
Comment #28
Tronux commentedSame 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 -_-