NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar ryandemmer
ryandemmer
3 Jun 2020

Summary of Changes

The onchange event is not triggered on a form element when the element's value is updated programmatically, only on user input, therefore a "change" event must be dispatched when the user id field value is set.

Without dispatching a change event, the change event listener created for the data-onchange attribute is not triggered, and the associated function is not called.

Testing Instructions

Edit administrator/components/com_content/forms/article.xml and set an onchange attribute for the create_by field, eg:

<field 
    name="created_by" 
    type="user"
    label="COM_CONTENT_FIELD_CREATED_BY_LABEL"
    onchange="(function(){console.log('change')})()" 
/>

Create or edit an article, and in the Options tab, select a new user for the Created By field.

Expected result

In the browser console, "change" should be displayed when the new user is selected.

Actual result

Nothing is displayed in the console as a change event is not triggered.

Documentation Changes Required

None.

avatar ryandemmer ryandemmer - open - 3 Jun 2020
avatar ryandemmer ryandemmer - change - 3 Jun 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jun 2020
Category JavaScript Repository NPM Change
avatar ryandemmer
ryandemmer - comment - 3 Jun 2020

This has already been proposed, tested and merged - #21323 - but seems to have been dropped at some stage.

avatar richard67
richard67 - comment - 3 Jun 2020

Ping @wilsonge .

avatar richard67 richard67 - test_item - 4 Jun 2020 - Tested successfully
avatar richard67
richard67 - comment - 4 Jun 2020

I have tested this item successfully on 6d0d606

Hints for other testers:

  1. It needs to run npm to "compile" the changed js.
  2. I had to force reload the page in order to get rid of cached js.

No idea why this change got lost.


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

avatar wilsonge wilsonge - change - 5 Jun 2020
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-06-05 21:45:08
Closed_By wilsonge
Labels Added: NPM Resource Changed ?
avatar wilsonge wilsonge - close - 5 Jun 2020
avatar wilsonge wilsonge - merge - 5 Jun 2020
avatar wilsonge
wilsonge - comment - 5 Jun 2020

Obviously got lost at some point in merge conflicts - thankyou!

avatar ryandemmer
ryandemmer - comment - 6 Jun 2020

Thank you @wilsonge !

Add a Comment

Login with GitHub to post a comment