? Pending

User tests: Successful: Unsuccessful:

avatar ryandemmer
ryandemmer
31 Jul 2018

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 - 31 Jul 2018
avatar ryandemmer ryandemmer - change - 31 Jul 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Jul 2018
Category JavaScript
avatar ryandemmer ryandemmer - change - 31 Jul 2018
Title
Trigger "onchange" event after updating input value
Trigger "change" event after updating user field input value
avatar ryandemmer ryandemmer - edited - 31 Jul 2018
avatar ryandemmer ryandemmer - change - 31 Jul 2018
The description was changed
avatar ryandemmer ryandemmer - edited - 31 Jul 2018
avatar wilsonge wilsonge - close - 31 Jul 2018
avatar wilsonge wilsonge - merge - 31 Jul 2018
avatar wilsonge wilsonge - change - 31 Jul 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-07-31 11:12:07
Closed_By wilsonge
Labels Added: ?
avatar ryandemmer
ryandemmer - comment - 31 Jul 2018

Thank you @wilsonge !

avatar wilsonge
wilsonge - comment - 31 Jul 2018

Thankyou!

avatar ryandemmer
ryandemmer - comment - 3 Jun 2020

This PR, although merged into 4.0-dev, does appear to have been dropped at some stage.

I would imagine this may have happened when the files were moved from media/system/webcomponents/js/ to media/system/js/fields/

The issue still exists, as you can see here - https://github.com/joomla/joomla-cms/tree/4.0-dev/media/system/js/fields/joomla-field-user.js

avatar brianteeman
brianteeman - comment - 3 Jun 2020

@ryandemmer please create a new issue and refer to this one - already merged and closed issues rarely get noticed. Thanks

avatar ryandemmer
ryandemmer - comment - 3 Jun 2020

Done - #29404 - Thanks @brianteeman :)

Add a Comment

Login with GitHub to post a comment