Steps to reproduce:

1) Add a filter (any filter), and expose it.
2) Try to set the identifier to "value" or to a identifier already in use

Result:
The form closes, and the validation message is not displayed. The submit function did not run, and the new settings haven't been saved.

Additional WTF:
The default value of the identifier field is ''.
So, if you leave the identifier field empty, it will save the form.
expose_validate() does not run, and the behaviour above does not happen, even though it should, since expose_validate() also checks that the field is not empty.

All this is not an issue in Views-6.x-3.x, only in the D7 version.

Comments

bojanz’s picture

Also, if the settings form is saved with an empty identifier field, bad things happen, among them:

Notice: Undefined index: identifier in views_handler_filter->exposed_info() (line 396 of views/handlers/views_handler_filter.inc).
Notice: Undefined index: in template_preprocess_views_exposed_form() (line 604 of views/theme/theme.inc).
Notice: Uninitialized string offset: 0 in element_children() (line 5484 of includes/common.inc).

These notices were mentioned in the original issue (#868808: Exposed filters are broken).

iamjon’s picture

bojanz,
is this error still occuring?

bojanz’s picture

Last I checked (a week ago), it did.
Will recheck and update the issue, but I'm not optimistic about it fixing itself without human intervention.

Edit: Still not working.

bojanz’s picture

Title: Exposed filter validation is broken » Options form needs to be re-rendered if it failed validation
Status: Active » Needs review
StatusFileSize
new2.79 KB

Okay, so the problem is similar to the "Override" one that we fixed (thanks to merlinofchaos) a few weeks back:
The options form isn't getting re-rendered after failing validation, so the error never gets displayed, the form just closes.
This affects every options form: filters, sorts, doesn't matter which...

My solution might be a bit crude, but in any case I think this is the right piece of code to put rerender in, otherwise we'd have to add the code to each options_validate() function.

Also, my editor likes to fix whitespace issues.

bojanz’s picture

StatusFileSize
new2.77 KB

This one's nicer.

bojanz’s picture

StatusFileSize
new2.73 KB

Had one line too many. Looks like I need sleep :)

dawehner’s picture

StatusFileSize
new8.83 KB

Here is a patch which adds testing of

* date filter validation
* exposed filter validation

dawehner’s picture

Status: Needs review » Fixed

Awesome, this bug is fixed now!

Test changes ported to d6.

Status: Fixed » Closed (fixed)

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