views2 date filter breaks when exposed

Joined: 11/18/2007
User offline. Last seen 3 weeks 5 hours ago.

D6 site. CCK, CCK date module. Views2 installed.
I have created a content type which has a CCK date field.

I can create a view using the CCK date field as a filter, however as soon as I expose the filter, I get an error "An illegal choice has been detected. Please contact the site administrator". Well, I asked the site administrator (me) and he was no use at all...

This does look like a genuine bug, according to one entry in the CCK "date" issue queue: http://drupal.org/node/339348 but I always suspect my own stupidity before looking elsewhere! I would love to know whether any of our G&G community has experienced the same issue, or can throw some light on this.

It seems like a pretty fundamental thing to do - build a view in which the entries are filtered by date, with an exposed filter...

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
User offline. Last seen 1 day 4 hours ago.
I fix it.

Well, I personally go into the code, find the issue, fix it, then post a patch.

In this case it is only coming up some of the time and for some people. What version of PHP are you using?

Is there a default value in the exposed filter? If not, how is the filter setup to handle no value?

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 11/18/2007
User offline. Last seen 3 weeks 5 hours ago.
fairly certain...

Hi Matt -

I'm fairly certain that I am setting a default, although the filter certainly does not behave as such.

In the area where you set up the filter, I can find three places to set the defaults:
1. dropdown field labelled "Absolute Value". This defaults to "-Year", unless you select a specific year from the dropdown list.
2. Under this, a bit further down, is a text field labelled "Date default:"
3. Under this is another field labelled "To date default:"

Under field (1) there is text which says:

Relative values will be used if no date is set above. Use 'now' to default to the current date at runtime or add modifiers like 'now +1 day'. The To date default value is used when the operator is set to 'between' or 'not between'.

If the filter is exposed, these values will be used to set the inital value of the exposed filter. Leave both date and default values blank to start with no value in the exposed filter.

My operator is "is equal to", and I have left the first field set to "-year", set the second field to 'now' and left the third field blank.

I have also tried various combinations of these.

It looks to me as though the date filter in the view is not being initialised before it is first displayed. Once it displays (with the "illegal selection" error, you can then enter a date in the selector, and it seems to work from then on - for that session).

Also, I cannot get rid of the words "Absolute value" displaying above the date selector.

I've tried to have a look into the filter code, but this particular module is extremely complex.

I agree, it looks like an initialization problem, but I am not sure where else to look.

I'll keep testing (its getting late this end... probably tomorrow) and let you know what I find...

BTW: PHP 5.2.6 is installed.

Joined: 11/18/2007
User offline. Last seen 3 weeks 5 hours ago.
latest dev shapshot is broken too

I've tested the latest dev snapshot (yeah, I know this is risky), but it still doesn't work correctly. In fact, it doesn't work at all! No matter what date you select in the exposed filter (and I'm only selecting a year btw), the view returns a list of ALL of the nodes.

It's as though the date filter is not even working anymore.

Do you know of any D6 sites which are using the exposed date filter to allow users to view lists of nodes by selecting the year via an exposed field?

Edit: The issue queue for the date module appears to be growing rapidly. Something has clearly gone very, very wrong with this module.