So I've got a Date field in one of my content types (it has From/To so it's more like a timespan), and I'm trying to create a view with exposed filters to allow users to search for nodes by specifying a date range. I used two filters: "Date, greater than or equal to" and "To Date, less than or equal to". I exposed these filters and locked the operator. Here's where I encountered a few problems:

1) Since I haven't checked Optional for the exposed filters, I would expect the view to initially have no results displayed, since the Date fields are required and they haven't been filled out. In reality, it seems that those filters are just ignored and all nodes matching the remaining filters (published = yes, etc.) are displayed. I'm not sure whether this is a bug, but it doesn't make much sense to me either way.

2) To solve the above problem, I tried entering "now" in the Option field for both filters, since that should cause the view to return no results at first (all my dates are in the past). This did work, but it also seems to break the rest of the view: I can't ever get any results, no matter what I put in.

3) And finally an unrelated issue: When entering values into the exposed filters, if I enter only a date range and leave the time boxes blank, it acts as though I didn't enter anything at all and takes me back to the base view with the input boxes blanked. This may not exactly be a bug, but it struck me as odd that there wasn't at least some sort of error message, to reassure me that the view actually received the data I entered. I don't want to force people to enter times, so I experimented with setting a default time in the filter setup, but it never showed up in the boxes on the view page (I guess that might actually be a separate issue).

Help on any of these issues would be appreciated; I haven't worked with Exposed Filters very much, so some of these problems might just be due to my ignorance on the finer points of using them.

Comments

KarenS’s picture

Status: Active » Closed (duplicate)

Start by moving up to the 5.2-dev version, the rc version is out of date and pretty broken (I'm just about to issue a new one). If you're using PHP4, wait until tomorrow to try it, I committed some PHP4 fixes today that won't show up in the tarball until tomorrow. Then re-create your view and its filters and see if it's working the way you want.

If you have problems after that, there is already an issue about problems with the date filter you can use.