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.

CommentFileSizeAuthor
#4 date-1422600-4.patch623 bytestim.plunkett

Comments

karens’s picture

Priority: Normal » Major

I'm hoping someone can help on this issue, I'm no javascript expert.

karens’s picture

Title: The javascript that auto-populates the end date is throwing errors on the end date even if no end date is selected » The javascript that auto-populates the end date is populating the end date even if no end date is selected

To 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.

karens’s picture

Status: Active » Fixed

Fixed 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

tim.plunkett’s picture

Assigned: Unassigned » karens
Status: Fixed » Needs review
StatusFileSize
new623 bytes

The 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.

karens’s picture

Status: Needs review » Fixed

I ran into the last issue when working on #323852: Dropdowns shouldn't include a blank option when required and fixed it differently there.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.