When I add a Date - date filter to a view then the "Value" field is missing from the form unless the Date Popup module is enabled.
When I add a Date - date filter to a view then the "Value" field is missing from the form unless the Date Popup module is enabled.
Comments
Comment #1
gustav commentedSteps to reproduce this bug:
1) Install Drupal 5.7 with Views 5-.x-1.6, CKK 5.x-1.6.1, Calendar 5.x-2.x -dev and Date 5.x-2.x and enable Date, Date API, Views, ViewsUI and Calendar.
2) Add a date field of type date to an existing content type. Let's give this field the name 'time'.
3) Create a new view by going to admin/build/views/1/edit and in the "Filters" section add a new filter "Date: time - date (field_time)".
You will notice that this filter is missing a field for the "Value".
Comment #2
gustav commentedWhen the Date Popup module is enabled then the "Value" field is present for this filter and one can select a date but the filter appears to be ignored. So even if one specifies that one wants nodes only with a particular date the view still shows all nodes from any date.
Comment #3
karens commentedThis particular problem is fixed, but there are still other issues with using a date widget in views that I am working on.
Comment #4
gustav commentedThe value field is now shown, but whatever I enter there is not saved when I save the view. At least the next time I edit the view the field is blank again and also the filter appears to have no effect.
Comment #5
karens commentedI just committed some fixes to the way the filter works.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
zmove commentedReopen, I have the latest date 2 dev version and I have the same problems. The filters don't seems to be ignored, but the comparaison seems to be totally wrong. In fact I don't find the behavior of the filter, it's too buggy I don't understand what happen.
Comment #8
zmove commentedReopen, I have the latest date 2 dev version and I have the same problems. The filters don't seems to be ignored, but the comparaison seems to be totally wrong. In fact I don't find the behavior of the filter, it's too buggy I don't understand what happen.
Comment #9
ptone commentedYes, I just downloaded the 4/18/2007 dev snapshot and I'm seeing this
Entering information in the options box works ( ie now, or now -1 day)
But entering a date in the value box has no effect.
If you expose the filter, and set default - still no effect on initial load.
However if you submit the filter from its exposed widget while on the view - it does work. (Still just learning drupal, so maybe this is a views edit submit issue not really a filter issue).
If you disable the Date Popup module, such that the date field uses a single text field for both date and time, then all the CCK filtering works as expected, so I'm changing this from a CCK issue to a date popup issue.
-P
Comment #10
ptone commentedOK, I've found a workaround. I'm not submitting this as a patch, because its more of a hack because it shortcuts several lines in the date_view.inc file. I couldn't find quickly any documentation for views/cck developers.
As I suspected, there is something about submitting the views edit form. When date popup is enabled I get a dozen or so entries in the watchdog line like this after a "save and edit" on my view:
Invalid argument supplied for foreach() in /home/sbvvmaco/public_html/dev/sites/all/modules/cck/fieldgroup.module on line 394.
But since it seemed like the filter worked without the popup installed, but not with, I looked around in date_views.inc for popup conditional code and found a section in the function "_date_views_filter_handler"
If date popup is installed it seems to go through a process of creating a form element, inserting the value, then passing the form element to a function date_popup_input_value, which returns null (because for reasons I didn't fully pursue, its considering it an invalid date).
With NULL returned for the value of the filter, no filtering happens.
Interestingly, if date popup is not installed, the value used in the default part of the handler is just:
$value = $filter['value'];Using this line even when the popup is installed makes everything work as far as I can tell...
That is, replace line 126:
$value = date_popup_input_value($element);with
$value = $filter['value'];Sorry I can't provide more details, just started with all this PHP and Drupal stuff a month or so ago.
-Preston
Comment #11
karens commentedThe basic problem here is that when the Date Popup is used in an exposed filter, its #validate function never gets called, and that's what reconstructs the date and time values back into a valid date, so it returns an array of 'date' and 'time' back in the filter. If javascript is working, it does restrict the user from selecting invalid values, since that is done by jQuery. When Date Popup is used in a non-exposed filter, the #validate function *does* get called, and the filter 'value' contains a complete, validated string date value. A date_textfield will always contain a complete date as a string value, but again it will skip the #validate function if it's used in an exposed filter, but will run through #validate if it is not exposed, so sometimes it won't check for a valid date. So there are several different ways this filter can get processed and all of them need to be made to work.
I'm trying to figure out a method that will work reliably in all cases.
Comment #12
karens commentedI just checked in a fix that I hope will get this working correctly. We'll have to keep an eye on it to make sure it works in all situations.
Comment #13
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #14
koolhead17 commentedKarenS
i am having this problem with thelatest RC module.
the popup calender is working but after submit button am not getting the filter to work for me.
suggest me an alternative.
Comment #15
karens commentedDon't use the RC module, use the latest -dev version.