User tests: Successful: Unsuccessful:
Pull Request for Issue #32694 and #17515 for joomla 3
make calendar.js trigger "change" event when user select new date
Add to Isis index.php:
<script type="module">
if (window.jform_publish_up){
window.jform_publish_up.addEventListener('change', () => {
console.log('change');
})
}
</script>
Go to Article editing, and try to change the publish_up date.
In browser console you should get "change" message on each change
No message
Message
none
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript |
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-03-22 06:23:01 |
Closed_By | ⇒ | rdeutz | |
Labels |
This breaks existing functionality. If an onchange attribute is set on a target field then it will now be triggered twice!
@GeraintEdwards please create an issue with code example, to reproduce the problem
If you edit the file administrator/components/com_content/forms/article.xml and find the publish_up field at line 129 and add the attrtribute
onchange="alert(0);"
to this field and then edit and article and change the publish_up field (using the date picker) you will get the alert(0) being called twice where it should be called once.
the code now reads
if (self.inputField.onchange) { self.inputField.onchange(); } self.inputField.dispatchEvent(new Event('change', {bubbles: true, cancelable: true}));
where it should actually read
`self.inputField.dispatchEvent(new Event('change', {bubbles: true, cancelable: true}));``
the onchange handler will still get called by the dispatchEvent.
while were are at it the same error arises as line 238
@GeraintEdwards thanks!
You do not need to create an issue if you have a PR ;)
Hello @GeraintEdwards
I've recently upgraded to Joomla! 3.10.2 from 3.9.24 and not sure if I'm only the one who faces an issue only in Internet explorer 11. We have this error
we use 'onchange' event in calendar. debugger points to the new changes made in this PR. When we used 3.9.24 version we didn't have the issue.
May be you can help me out?
@Fedik seems ie11 doesn't support this way to trigger an event https://stackoverflow.com/questions/27176983/dispatchevent-in-chrome-but-not-in-ie11
Can you have a look Plesse?
for Joomla4 look there #32755