[BUGFIX] Fix a JS error in with TCE select wizard 21/30821/3
authorRémy DANIEL <dogawaf@no-log.org>
Wed, 18 Jun 2014 15:38:32 +0000 (17:38 +0200)
committerMarkus Klein <klein.t3@mfc-linz.at>
Mon, 23 Jun 2014 13:41:19 +0000 (15:41 +0200)
Fixes an exception with decodeURI when an item containing
a % (percent) character is added to a select.
jQuery is now only used to append the option and its label to the DOM.

Resolves: #59655
Releases: 6.3, 6.2
Change-Id: I245f2fbec347b7e149aeea1cb7148591dc47e6f8
Reviewed-on: https://review.typo3.org/30821
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index 55c5dd6..36db33f 100644 (file)
@@ -128,7 +128,9 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
                        // element can be added
                        if (addNewValue) {
                                // finally add the option
-                               $fieldEl.append('<option value="' + value + '" title="' + title + '">' + decodeURI(label) + '</option>');
+                               var $option = $('<option value="' + value + '" title="' + title + '"></option>');
+                               $option.attr({value: value, title: title}).text(label);
+                               $option.appendTo($fieldEl);
 
                                // set the hidden field
                                FormEngine.updateHiddenFieldValueFromSelect($fieldEl, $originalFieldEl);