2

My question is related to Drupal 7 Views Exposed Filter - How to Select all Taxonomy terms Upon adding new terms? however I have a different problem. I want to filter a view by users of specific roles and for that i have added the user field in views filter and exposed it.

The problem is that if i check "select all" in "options" and leave "Limit list to selected items" unchecked, the select shows "--Any--" as default selection and also includes any users added later but throws "An illegal choice has been detected. Please contact the site administrator" and does not load any views.

enter image description here

On the other hand, if i check "Limit list to selected items" in options it shows no error but then it will only load the selected users in options and not any user added later. The field "check_user" has a field collection relationship. How to solve this? Is this a bug or misconfiguration?

Using views 3.8 and Drupal 7.32

[EDIT]

I managed to remove the error by deselecting the "select all" option and checking all the users, this way the select list filter include the checked users in exposed filter and also any user added later. The select filter also provided "--Any--" option but when I first load the view, the first user in the list is automatically select instead of "--Any--". How to default the select filter to "--Any--"?

  • Is it a user reference field? – Sumit Madan Oct 22 '14 at 6:14
  • Yes, included in field collection. – Nonix Oct 22 '14 at 6:16
4

Don't choose select all option (it is a simple javascript effect to choose the values) or don't select any user from list. If you just choose expose the filter option it will display all the users list automatically.

  • Actually by not checking any option (neither select all nor any users/items), the view is perfectly loading with providing "--Any--" option at the first load. Thanks again for the hint. – Nonix Oct 22 '14 at 6:31
1

That error is documented in the following thread https://www.drupal.org/node/1177882#comment-8891105. This solution worked for me:

$form['your-views-exposed-filter-field-name-here']['#validated'] = true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.