Article

Organic Groups exposed filter error "An illegal choice has been detected. Please contact the site administrator." and choice defaults to an item, not ANY

Case: Drupal 7 installed, with Organic Groups 7.x setup. In Views, added an exposed filter for a particular field (that will filter from a Content Type that is set up as both a Group and a Group content in OG).

Exposed filter setup: Single filter, NOT required, Select all, NOT limited to selected items

Issues:

Not sure if this is a bug for exposed filters in general. But somehow, with this setup, the the dropdown list in the Views defaults to a selected item, instead of the expected ANY.

Due to this, another issue is presented on viewing from the frontend: the view page displays: "An illegal choice has been detected. Please contact the site administrator." Apparently this is due to the list already fetching a selection even before a user makes one.

Views, exposed filter in Drupal loads a pre-selected value selection instead of ANYExposed filter issue in Drupal Views

Drupal error, exposed filters views An illegal choice has been detected.

Fix:

As a workaround, the exposed filter should have the option selected:

  1. Edit your View, click to edit the exposed filter in question
  2. Check "Expose this filter to visitors, to allow them to change it"
  3. Choose desired Operator, normally "Is one of"
  4. WORKAROUND: Then under Options, immediately select "Limit list to selected items If checked, the only items presented to the user will be the ones selected here." If you will notice upon checking this, the Select all options have been unselected, leaving only the rest of the options/items checked. IMPORTANT! Check/Select all again.
  5. Click Apply to save and close the dialog box
  6. Save your View

Hope this helps!

Drupal exposed views, Configure filter criterion