From c09cfd402c39522381f10499161bea0a75a3db51 Mon Sep 17 00:00:00 2001 From: Oliver Bartsch <bo@cedev.de> Date: Wed, 17 Nov 2021 13:38:30 +0100 Subject: [PATCH] [BUGFIX] Dispatch change event for updated input field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RequestUpdate component, handling the TCA "onChange" functionality, adds an event listener to the main HTML field. In case of TCA type "input", this field never dispatches such event, because the user always changes the "human readable" field in the GUI. The main field is only updated manually by FormEngine after validating the new value. Therefore, the "onChange" property never had any effect for TCA type "input" fields. This is now fixed by dispatching a "change" event for the main field after its value has been updated. Resolves: #93613 Releases: master, 11.5 Change-Id: I9facf3548619b3733975fb5c8f28622d03002e7b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72205 Tested-by: core-ci <typo3@b13.com> Tested-by: Jochen <rothjochen@gmail.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Benni Mack <benni@typo3.org> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Jochen <rothjochen@gmail.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- .../Resources/Public/JavaScript/FormEngineValidation.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js index d1dc1accf8f4..5d51a019ac64 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js @@ -247,6 +247,9 @@ define([ } $mainField.val(newValue); + // After updating the value of the main field, dispatch a "change" event to inform e.g. the "RequestUpdate" + // component, which always listens to the main field instead of the "human readable field", about it. + $mainField.get(0).dispatchEvent(new Event('change')); $humanReadableField.val(formattedValue); } }; -- GitLab