To reproduce:

Create a view, node type
set the row style to "Node", just to make it simple.
add a Filter on Node: type. Expose it. Use the following options:

  • Operator: is one of
  • Node Type: I don't select any node types here, because I want to give the user the option to filter by node type, but leave it empty by default. This should be possible by selecting "Optional" (mentioned below). In reality, it breaks either way, so do whatever you want.
  • Unlock operator: check -- this is the critical component. When Unlock Operator is not checked, the view works fine!!! Aside from the initial "validation error" message, that is.
  • Optional: check
  • force single: no (uncheck)
  • remember: check
  • limit list: no

The resulting view in the preview will show an error: "An illegal choice has been detected", and will have the node type filter highlighted.

At this point, however, the preview filter has all node types selected, so if you hit "apply", the error goes away, but no node types are selected. The sql generated is (btw, I have 8 content types):

SELECT node.nid AS nid
 FROM node node 
 WHERE node.type in ('0', '0', '0', '0', '0', '0', '0', '0')

Changing the the exposed filter type to "is not one of", and leaving all content types selected, results in EVERY node getting returned, with the following sql:

SELECT node.nid AS nid
 FROM node node 
 WHERE node.type not in ('0', '0', '0', '0', '0', '0', '0', '0')

The view does not break when the filter is hidden.

sounds like fun, huh?

-Corey

Comments

jorgeegomez’s picture

I just encountered this bug. It may have something to do with these patches, could you try rolling them back?

#420340: node type filter doesnot locale : Translate node type filter.
#325796: translate node type in arguments : Translate node type argument.

jorgeegomez’s picture

I'm also getting the following error in the generated SQL, which may point to the solution:
If I leave the type unselected ("is one of:" ""), I get:

SELECT node.nid AS nid,
   node.type AS node_type
 FROM node node 
 WHERE node.type in ('tll')

I think 'tll' is indicative of a t('all') error.

If I select 'Webform', the generated SQL includes:

 WHERE node.type in ('tebform')

So it all points to one of those patches.

KathyIce’s picture

I'm having trouble with this too...

Recently updated to Acquia Drupal 1.2.12 (Drupal 6.13 core). That release has the patches referenced in #1. I am also using Views Bulk Operations.

The probelm shows up for me on views that I'm using for admin purposes.
Those views have several exposed Filters.. including exposing the Node Type filter. The problem seems to be limited to views where I have the node type filter exposed.

From the SQL, it appears that there may be a problem with the view not "seeing" any node types selected in the filter ( WHERE node.type in ('') ) when the view is first displayed...

After filddling around with various expose filter settings... the main one that seems to cause the problem is "unlock operator" (I've seen other references to that problem... )
If I unlock the operator... it gets a null result for "is one of" ... regardless of whether anything is selected. Selecting "is not one of" gets me a result. Locking the operator makes the problem go away...

this occurs on both Bulk Operations and Node view styles.

I believe there is a problem. Hopefully this will help you track it down.
For now, I can live without unlocking the operator on node filters.

Kathy

merlinofchaos’s picture

Status: Active » Fixed

Please try the -dev version, I believe this is fixed.

Status: Fixed » Closed (fixed)

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