From 0b7d25905aa53abcecd5b81c86b4d6b035fa71de Mon Sep 17 00:00:00 2001
From: Mona Muzaffar <mona.muzaffar@gmx.de>
Date: Tue, 21 Feb 2017 12:37:43 +0100
Subject: [PATCH] [BUGFIX] Fix append and prepend function of valuePicker

valuePicker appends and prepends now in the correct order.

Change-Id: Ic97b8a66469d43d9269f67f1de3f0cb40d1e8321
Resolves: #79937
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/51779
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../sysext/backend/Classes/Form/Element/InputTextElement.php  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php b/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php
index 79196ef44cc6..1c67c6c926f7 100644
--- a/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php
@@ -148,10 +148,10 @@ class InputTextElement extends AbstractFormElement
             $fieldChangeFunc = $parameterArray['fieldChangeFunc'];
             if ($mode === 'append') {
                 $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
-                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
+                    . '.value+=\'\'+this.options[this.selectedIndex].value';
             } elseif ($mode === 'prepend') {
                 $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
-                    . '.value+=\'\'+this.options[this.selectedIndex].value';
+                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
             } else {
                 $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
                     . '.value=this.options[this.selectedIndex].value';
-- 
GitLab