? ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
20 Mar 2021

Pull Request for Issue #32694 and #17515 for joomla 3

Summary of Changes

make calendar.js trigger "change" event when user select new date

Testing Instructions

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

Actual result BEFORE applying this Pull Request

No message

Expected result AFTER applying this Pull Request

Message

Documentation Changes Required

none

avatar Fedik Fedik - open - 20 Mar 2021
avatar Fedik Fedik - change - 20 Mar 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Mar 2021
Category JavaScript
avatar Fedik
Fedik - comment - 20 Mar 2021

for Joomla4 look there #32755

avatar joomdonation joomdonation - test_item - 20 Mar 2021 - Tested successfully
avatar joomdonation
joomdonation - comment - 20 Mar 2021

I have tested this item successfully on 0a2ae82


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32756.

avatar alikon alikon - test_item - 21 Mar 2021 - Tested successfully
avatar alikon
alikon - comment - 21 Mar 2021

I have tested this item successfully on 0a2ae82


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32756.

avatar alikon alikon - change - 21 Mar 2021
Status Pending Ready to Commit
avatar alikon
alikon - comment - 21 Mar 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32756.

avatar Quy Quy - change - 21 Mar 2021
Labels Added: ? ?
avatar rdeutz rdeutz - change - 22 Mar 2021
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
avatar rdeutz rdeutz - close - 22 Mar 2021
avatar rdeutz rdeutz - merge - 22 Mar 2021
avatar GeraintEdwards
GeraintEdwards - comment - 1 May 2021

This breaks existing functionality. If an onchange attribute is set on a target field then it will now be triggered twice!

avatar Fedik
Fedik - comment - 1 May 2021

@GeraintEdwards please create an issue with code example, to reproduce the problem

avatar GeraintEdwards
GeraintEdwards - comment - 3 May 2021

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

avatar GeraintEdwards
GeraintEdwards - comment - 4 May 2021

Issue #33538 created as well as PR #33540

avatar Fedik
Fedik - comment - 4 May 2021

@GeraintEdwards thanks!
You do not need to create an issue if you have a PR ;)

avatar rajeshstarlite
rajeshstarlite - comment - 13 Oct 2021

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

Screenshot 2021-10-13 at 7 04 18 PM

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?

avatar HLeithner
HLeithner - comment - 14 Oct 2021

@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?

avatar Fedik
Fedik - comment - 14 Oct 2021

please test #35819

avatar rajeshstarlite
rajeshstarlite - comment - 14 Oct 2021

Thanks @Fedik, it works now.

Add a Comment

Login with GitHub to post a comment