[BUGFIX] FormEngine: Restore select wizard for textarea elements 36/46036/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Sun, 17 Jan 2016 09:19:23 +0000 (10:19 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Sun, 17 Jan 2016 14:45:17 +0000 (15:45 +0100)
Add the data-formengine-input-name attribute to FormEngine TextElements
so that the wizards can locate it. As the textareas don't differentiate
between human readable and hidden fields add a check to the tbe change
handler if the form field and the human readable field are identical and
skip triggering the change event again.

Resolves: #71679
Releases: master, 7.6
Change-Id: I69e6a4f3e9f19c68bd02a0029322d52323286194
Reviewed-on: https://review.typo3.org/46036
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Form/Element/TextElement.php
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js

index 603f591..339e500 100644 (file)
@@ -143,7 +143,8 @@ class TextElement extends AbstractFormElement
 
             // calculate attributes
             $attributes['id'] = StringUtility::getUniqueId('formengine-textarea-');
-            $attributes['name'] = $parameterArray['itemFormElName'];
+            $attributes['name'] = htmlspecialchars($parameterArray['itemFormElName']);
+            $attributes['data-formengine-input-name'] = htmlspecialchars($parameterArray['itemFormElName']);
             if (!empty($styles)) {
                 $attributes['style'] = implode(' ', $styles);
             }
index c2ab5b1..903ecd4 100644 (file)
@@ -146,7 +146,9 @@ var TBE_EDITOR = {
                // modify the "field has changed" info by adding a class to the container element (based on palette or main field)
                var $formField = TYPO3.jQuery('[name="' + el + '"]');
                var $humanReadableField = TYPO3.jQuery('[data-formengine-input-name="' + el + '"]');
-               $humanReadableField.triggerHandler('change');
+               if (!$formField.is($humanReadableField)) {
+                       $humanReadableField.triggerHandler('change');
+               }
                var $paletteField = $formField.closest('.t3js-formengine-palette-field');
                $paletteField.addClass('has-change');