Opened 4 years ago
Closed 4 years ago
#31644 closed Cleanup/optimization (wontfix)
Add a change event to DateTimeShortcuts.js.
Reported by: | Alton Ray Carlson II | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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.
Attachments (1)
Change History (2)
by , 4 years ago
Attachment: | DateTimeShortcuts.js added |
---|
comment:1 by , 4 years ago
Component: | Uncategorized → contrib.admin |
---|---|
Has patch: | unset |
Resolution: | → wontfix |
Status: | new → closed |
Summary: | Solution so that DateTimeShortcuts.js can fire a change event on its associated DateField → Add a change event to DateTimeShortcuts.js. |
Note:
See TracTickets
for help on using tickets.
Thanks for this ticket, however IMO we shouldn't add events that would not be used in Django itself. Moreover you can always add events to calendar shortcuts on your own.