Closed (fixed)
Project:
Date
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
31 Jan 2012 at 11:17 UTC
Updated:
24 Feb 2012 at 09:20 UTC
Jump to comment: Most recent file
The javascript that auto-populates the end date is throwing errors on the end date even if no end date is selected. This may have been happening before but is made more visible by the fixes to #1417872: Date Select does no granularity validation unless year is filled out.
The javascript needs a test to see if the 'Show end date' checkbox is selected to only throw errors on the end date in that case.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | date-1422600-4.patch | 623 bytes | tim.plunkett |
Comments
Comment #1
karens commentedI'm hoping someone can help on this issue, I'm no javascript expert.
Comment #2
karens commentedTo clarify, the javascript is not throwing errors. The javascript is creating an end date that matches the start date, even if the start date has errors and even if the checkbox to show the end date is not selected. So if the start date has errors and no end date is selected, you get messages that both the start and end date have errors. This could be solved by keeping the javascript from populating the end date if the show end date box is not selected.
Comment #3
karens commentedFixed this without javascript by implementing the pre_validate hooks in Date API to wipe out the end date if the option to show the to date is not checked.
http://drupalcode.org/project/date.git/commit/f96b409
Comment #4
tim.plunkettThe conditional in date_empty_end_date() checks against show_todate, which is 0 when optional and not used, 1 when optional and used, and FALSE when required.
Ideally it would check $field['settings']['todate'] instead, but that's not available.
So, this patch unbreaks for when the to date is required.
Comment #5
karens commentedI ran into the last issue when working on #323852: Dropdowns shouldn't include a blank option when required and fixed it differently there.