12

My site has a node type called "Resource". This node type has a field called "Reviewed"; this field is a single on-off checkbox:

Screenshot of Manage Fields form

I've created a view that lists all of the nodes of node-type "Resource". I'd like to filter that view so it only displays nodes that have the "Reviewed" checkbox checked. However, when I try to add that field to my view, I'm shown the following:

Screenshot of building a view

I would expect the "Options" select box to be a checkbox that I could either check or leave empty. Instead, I'm given a select box with "Select all" in it. Whether I select this or not, I'm then presented with an error message saying that there are "No valid values found on filter: Content: Reviewed.":

"No valid values found" error message

I've tried the "exposing the master display trick" at http://technology.blue-bag.com/top-tip-drupal-views-no-valid-values-found-filter, but that hasn't worked: there's no "unknown" filter in the master display, so there doesn't appear to be anything to fix.

Any idea as to how I can achieve the result I'm looking for? And what's the deal with the strange UI with the select box rather than a checkbox? Would be good to know if there's some logic to it; if not, I'll post an issue to the appropriate drupal.org issue queue.

1
  • I would expect a filter for a boolean field to have 3 states: 1. Only show results with "Yes", 2. Only show results with "No", 3. Show all results.
    – donquixote
    Commented Mar 9, 2017 at 3:53

3 Answers 3

11

this is some sort of a bug / incosistency of how the boolean field is made. if you leave it in default, without any 0 / 1 values, it wont show them in places like this filter.
But : the values are there :) under "Select all" you have 2 rows that just dont have captions. When you pick one of them, you can see that the SQL for your view is changed.
The workaround would be to add some captions to the values in the field defintion.

3
  • Thanks, @mojzis! I've posted to the Views issue queue at drupal.org/node/2027171, too.
    – Jim
    Commented Jun 24, 2013 at 21:39
  • @Jim, sorry, i should have stressed its more of a problem in the boolean field, and apparently there is allready someone working on it :) drupal.org/node/1750950
    – mojzis
    Commented Jun 25, 2013 at 6:28
  • ah, thanks! I've commented on the issue I posted to the Views issue queue to link it up with the core D8 issue.
    – Jim
    Commented Jul 3, 2013 at 13:24
2

I was also facing the same problem, the Label of the field was not displayed in the view's exposed filter.

I then went to the field settings in content type for that checkbox field and updated On Value as 1 and OFF value as 0.

Now the Label appears in exposed filter and works as expected.

1

I encounter the same issue and instead using Select All you should select no value. If you already have a value selected use Ctrl to undo your selection.

Source

1
  • 1
    Can you expand on this a little and explain why this solves the question and not just your problem?
    – mpdonadio
    Commented Oct 31, 2013 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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