If you have 2 different fields with the same name (e.g. "status"), and you add both of them as exposed filters, the views2 UI is helpful and suggests "status_1" for the "Filter identifier" on the 2nd one to prevent collisions. However, if you don't know any better, and manually strip off the "_1", views doesn't validate that you've already got an exposed filter with that identifier. Furthermore, the help text says that the identifier "Cannot be blank", but it doesn't say it must be unique.

I don't have time to roll a patch now, and probably won't until after the d.o upgrade sprint, but if no one's fixed this by then, I'll try to work on it. ;)

CommentFileSizeAuthor
#2 views-363516-unique-identifiers.patch2.05 KBdagmar

Comments

dagmar’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev

This is important for exposed sorts too. I'm changing the version of this issue beacuse is usefull for: #228510: Exposed Sorts

If you have 2 different fields with the same name (e.g. "status"), and you add both of them as exposed filter

Exposed sorts may have the same name, like sort by status and filter by status. Right now, my patch for exposed sorts add a "sort_" before the id, but if an user remove it, we have again, duplicated ids.

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new2.05 KB

So, here is the patch.

We need to add a:

    if (!$this->view->display_handler->is_identifier_unique($form_state['id'], $form_state['values']['options']['expose']['identifier'])) {
       form_error($form['expose']['identifier'], t('This identifier is used by another handler.'));
    }

In expose_validate() function in #228510: Exposed Sorts when this issue is solved.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed to 2.x and both 3.x branches.

Status: Fixed » Closed (fixed)

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