-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
I'm working on an auto-save feature for my current project. I check for changes in the page editor like this:
document.addEventListener("input", (e) => this.registerChange(e.target));
document.addEventListener("change", (e) => this.registerChange(e.target));
Some fields like TinyMCE need special treatment, but I also realised that date inputs also do not trigger a save and I was wondering why.
This is the fix that makes it work:
// Monitor datepicker changes
$(document).on("change", ".InputfieldDatetimeDatepicker", (e) =>
this.registerChange(e.target)
);
But I think it would be better to also trigger the change
event in InputfieldDatetime.js
:
if (pickerVisible) {
$datepicker.on("change", function (e) {
var d = $datepicker.datepicker("getDate");
var str = $.datepicker.formatDate(dateFormat, d);
// add .trigger('change') here
$t.val(str).trigger("change");
});
}