Forum OpenACS Development: DHTML Calendar (core.js) patch

Request notifications

Posted by Frank Bergmann on
The "DHTML calendar" is included in OpenACS ~/packages/acs-subsite/www/resources/core.js. It's a small calendar that works together with ad_form date entry fields etc.

In one ]project-open[ page we need to trigger a JavaScript function if the date changes via the "change" event. This works if a user manually changes the entries in the ad_form fields.

However, this even isn't fired if the Calendar modifies the date. This behavior is documented. There is no easy workaround.

The solution is to manually dispatch an event after changing the fields. However, this implies modifying the "core.js" file as part of OpenACS.

=> Could somebody with commit rights please add the 4 lines after "//Trigger the "change" event" comment to the end of the selWidget() function?

cal.selM.value = m;
cal.selY.value = y;
cal.selD.value = d;

// Trigger the "change" event of the date
var event = new Event('change');