Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to use the filter possibility against the keyword 'now'. But with Views 3, the value in the setting form is not saved. I have debugged this now for 2 hours but I cannot find the difference in Views 2 and Views 3 that makes the date filter form to not save the value 'now' in the filter settings form.
Does someona has an idea, what wrong here?
Comment | File | Size | Author |
---|---|---|---|
#1 | views-date_now_form_validation-dev.patch | 555 bytes | ayalon |
Comments
Comment #1
ayalon CreditAttribution: ayalon commentedI finally found the the codeline, that kills the form validation:
current dev version code
fixed and working code
Comment #2
dawehnerMh critical.
Critical is a wsod or something which brakes your site.
This isn't a difference between views2 and views3.
Can you please explain why this fixes the issue?
The validation just checks. The "now" is part of the php date-functions.
But yes i can reproduce the issue here. This was seen before on d7, too.
I fear that the real problem is somewhere else.
Comment #3
ayalon CreditAttribution: ayalon commentedThe point is, that the form validation are not executed.
Because of the code line above, all form validation are reset. I set some breakpoints and the validation form of the date module (date/includes/date_api_filter_handler.inc) is never executed.
The problem has nothing todo with the word "now" and no relation to the date function.
The problem is, that the form validation not happens and therefore the value is not validated and saved.
And yes, its critical: Think about a page, that uses this functionality. All entries will be displayed and nothing will be filtered. Can be very very ugly.
Comment #4
dawehnerWell this is major but it's not critical afaik.
The main question is why this works on views 2.x. This line didn't changed in views 3.x
I guess the problem is somewhere else.
Comment #5
cossme CreditAttribution: cossme commentedsorry, I haven't found a cause yet though searching and very interested in a solution ... so subscribing
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedI can't duplicate this.
Further, 'now' is not a keyword that Views date filters support.
Is this an issue only with date.module?
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedOk, untrue. I can duplicate this on both Views 2 and Views 3 using the user: name filter.
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedIronically, fixing the validation makes user: name work...but I can't get date to work. But date seems to have its own special Specialness that I don't understand. I think the core problem here is fixed. In all branches.
Comment #9
ayalon CreditAttribution: ayalon commentedDoes this mean, that 'now' filter in Views 3 works? Did you commit anything?
Comment #10
ayalon CreditAttribution: ayalon commentedI tested this with the version of 18.11 Dev and the bug still exists. You cannot validate the form, the value "now" is not saved.
Comment #11
ayalon CreditAttribution: ayalon commentedMerlinofchaos:
Instruction on how to reproduce this:
- Create a view with 2 fields: Node Title and a CCK Date field
- Now filter for the CCK Date field
- Try to save the keyword 'now' as a default filter
- Because of the form validation problem, you will NOT be able to save the keyword 'now'
- If you set a breakpoint, the form validation will never be executed.
- If you comment out the line above, the form validation will be executed and the value will be saved.
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commentedI fixed the problem with validation, yes, using the patch provided. The views filters that also suffered the problem was fixed.
I don't understand why the 'date' filter continues to not work, but that's date.module. I am not going to debug date.module to figure out what's going on. Unfortunately, I do not have the time for that.
Comment #13
ayalon CreditAttribution: ayalon commentedThanks for your response.
Using the 3.x dev from 21-11-2010 and the latest date module 21-11-2010 fixed all the issues with the form validation and now filter. Thanks for your help.
Comment #15
Rob T CreditAttribution: Rob T commentedThanks for the patch, which works well in a pinch until I can update our Views module in a few days on a particular site.