I am sorry if this is a duplicate; I looked around first.

If I have an exposed filter enabled for a view and put it in a block, and then submit the form in the block, but the form does not pass validation, the original filter form shows up above the view (as it would be without putting the exposed filter in a block).

The usual case I see it is when I have a taxonomy term autocomplete exposed filter. The form tries to make sure that the term exists, and throws an error if it does not. So, if I leave a few letters in the autocomplete field, an error is raised.

Some of the problems this creates:

1) Kind of defeats the purpose of having the form in a block
2) Puts the same exact form on a single page, causing ID collisions

Still looking for ways to solve this. Thanks for all your great work.

Comments

zzolo’s picture

StatusFileSize
new75.75 KB

Oh, also, a screenshot.

zzolo’s picture

I have actually run into this on both AJAX and non-AJAX.

zzolo’s picture

I have started to stare at the Views code which is pretty intense. I can't seem to find where exposed forms are added to a regular views display. Any help would be appreciated. I am figuring a simple look at if the view has an "exposed block" would be a good check.

zzolo’s picture

Status: Active » Needs review
StatusFileSize
new756 bytes

With the help of pingers, we created this patch that checks to make sure that if there are errors that the main exposed form is not displayed.

merlinofchaos’s picture

Does this break the exposed form if it's *not* in a block, though?

zzolo’s picture

As far as I have tested, regular exposed forms show up after errors. I believe this is because you are caching the form after its rendered once (as a block), and this is simply making sure that it does not appear again.

neil.brown’s picture

subscribing.

merlinofchaos’s picture

Status: Needs review » Fixed

Ok, yes, I see what you mean. Committed this to all branches. Thanks!

Status: Fixed » Closed (fixed)

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