3

[Edit 3: this turned out to be one of those phantom views problems (*) - after messing around w/ a test view cobbled together to use the custom filter, etc., etc., I ended up simply cloning the original mis-behaving view block, added it to a single page, and the thing worked! So I took the original out of circulation and am now using the fully-functional clone. I have no idea why the clone works and the original doesn't, but I'm not going to argue with the result.

(*) On occasion I have seen weirdness that seems to be related to choosing one views option, like a contextual filter validation method, then going a different route with a different validation method, and seeing what appears to be behavior related to the original choice. Revisiting the settings fixed this "phantom" behavior....]

I created a custom exposed filter for a view, and everything works great when there are results for the view. However, when the view returns no results, things get weird: my results aren't updated at all (I have auto-submit on), and I get a popup showing:

An AJAX HTTP error occurred.

HTTP Result Code: 200

Debugging information follows

Path: /views/ajax

StatusText: OK

ResponseText:

[followed by what looks like the beginning of normal results]

I've searched high and low for a related Views issue on Drupal.org, as well as on StackExchange and the general internets, but I haven't seen a similar problem reported.

I tried flushing the Drupal cache, turning off Views caching, turning on Views debugging, all to no avail (nothing is written out to the log in the error situation). There's nothing written to dblog when the error happens.

I tried adding a (Global: Text area) message to be shown for No Results Behavior under Advanced for the view, but that didn't change anything, and I don't see the message.

Out of curiosity, I added hook_views_pre_render, and I see the appropriate row count in the results for non-zero result sets, as expected. However, I see hook_views_pre_render being hit with zero results for the error cases, but there is another pass through the hook with results!

Furthermore, for the error cases, hook_views_post_execute is hit with results = 0, 1 row, and N rows, where N is the same number of results seen for the spurious result set for hook_views_pre_render for the same error case. For non-error cases, both hooks are only hit once with the correct number of results.

Anyone have any ideas about this?

Thanks! Lee

[Edit: I'm running Drupal 7.36 and Views 7.x-3.10]

[Edit 2: I applied the custom filter to a new, simpler view display - a page display, this time - and hardcoded a contextual filter and a matching taxonomy term in the custom filter code. It turns out I was wrong about the error condition - there's actually one row being returned in the case that is showing up with an Ajax error for the original view block display. Furthermore, I can run this page display with or without Ajax and not have a problem. Lastly, for the 1-row case, I do see the 2 views hooks being called 2x each - once with 0 results, and once with 1 result for each hook.]

  • Try toggling use ajax in your views advanced settings – Patrick Ryan Apr 17 '15 at 19:13
  • @PatrickRyan - thanks for the quick response! I had had use ajax on. When I turn it off, the custom filter no longer appears, and there are no results for the view. Same thing happens if I additionally turn off Autosubmit. Note: this is for a block view display. – user1778508 Apr 17 '15 at 19:28
  • @PatrickRyan - I just added some additional info in an edit of my original post. – user1778508 Apr 17 '15 at 20:39
  • See my third edit - the problem has been resolved! – user1778508 Apr 17 '15 at 22:44
1

See my third Edit to the OP. The problem has magically been resolved by using a clone of the original block display. I don't know why this is the case, but that did the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.