#31644: Solution so that DateTimeShortcuts.js can fire a change event on its
associated DateField
------------------------------------------------+------------------------
Reporter: arc720 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Uncategorized | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
For the current DateTimeShortcuts.js, when you click on a date in the
calendar and the date is copied into the textbox, no event fires. I have
added in a few lines of code that will fire a change event for the textbox
(DateField) that the calendar is associated with. On line 410, add this:
{{{
if ("createEvent" in document) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", true, true);
DateTimeShortcuts.calendarInputs[num].dispatchEvent(evt);
}
else
DateTimeShortcuts.calendarInputs[num].fireEvent("onchange");
}}}
I have attached the file.
--
Ticket URL: <https://code.djangoproject.com/ticket/31644>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.