On my view I am getting the message 'An illegal choice has been detected. Please contact the site administrator.' when I try to paginate when no filters have been selected. If I choose a filter, pagination works fine. The issue seems to be that BEF is adding blank parameters to the query string.

For example, the href for the next page button, when no filters have been applied looks like this:

games-applications?title=&sort_bef_combine=&sort_order=&sort_by=&page=1

Note the three empty variables. If I choose a sort by option, the href for the next button now looks like this

games-applications?title=&sort_bef_combine=created%20DESC&sort_order=DESC&sort_by=created&page=1

Interestingly enough, if I use title filter, but leave the sort filter blank the href for the next button looks like this:

games-applications?title=E&sort_bef_combine=%20&sort_order=&sort_by=&page=1

The pager works, despite only a space in the sort_bef_combine variable and the other two being blank.

Also if I create a url without the empty variables, the next page works:

games-applications?page=1

Has anyone else run into this? It sounds similar to @djsmacedo issue on #1867418: An illegal choice has been detected. Please contact the site administrator.. I've attached an export of the view.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ryan.armstrong’s picture

Project: Better Exposed Filters » Views (for Drupal 7)

Tracing the error has led me to believe that this is an issue with Views rather than BEF. I can see the empty parameters being passed via the $input variable in the pager plugin in views.

troybthompson’s picture

I'm having a similar issue. When I disable BEF, I'm still getting the problem. It happens when I paginate using the default sort.

BarisW’s picture

Here's a way to fix it, until this gets properly fixed upstream: http://drupal.stackexchange.com/a/57790

aufumy’s picture

FileSize
1.08 KB

The stackexchange link didn't work for me, this patch does. The checkboxes fields had grouped chosen instead of single. Grouped threw this error, but not single.

aufumy’s picture

Status: Active » Needs review
wilco’s picture

Hi all, so I noticed with the patch above (which helped me greatly) that there's a use case where this will return a PHP Notice: Undefined index: #type in views_exposed_form_submit()

The following re-roll of the patch adds an extra assertion to check for this missing "#type" key.

I've also renamed the patch so give it more description. Hope this helps others too.

aufumy’s picture

Re-rolled the same patch against 7.x-3.14

aufumy’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: views-exposed-type-230393.patch, failed testing.