Project

General

Profile

Actions

Bug #81050

closed

Empty table row is added each time saving a Table CE

Added by Georg Tiefenbrunn over 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2017-04-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce in TYPO3 CMS 8.7 LTS (composer; {nl} = newline):

1) Create a new table CE
2) Add dummy content:

A | B | C
1 | 2 | 3

3) Save.
Content in DB is:
A | B | C
1 | 2 | 3

Content in textarea now is:
A | B | C
1 | 2 | 3
{nl}

3) Save again.
Content in DB is:
A | B | C
1 | 2 | 3
{nl}

Content in textarea now is:
A | B | C
1 | 2 | 3
{nl}
{nl}

This behavior was introduced with 84be5e61 where the working part (see removed part)...

<textarea class="form-control" rows="' . $rows . '" disabled>' . $itemValue . '</textarea>

code was replaced with ..
            $html[] =               '<textarea class="form-control" rows="' . $rows . '" disabled>';
            $html[] =                   htmlspecialchars($itemValue);
            $html[] =               '</textarea>';

... which adds the extra newline character when generating the textarea.

Combining the 3 keys to one fixes this issue:

Index: vendor/typo3/cms/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/typo3/cms/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php    (revision )
+++ vendor/typo3/cms/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php    (revision )
@@ -190,9 +190,7 @@
         $html[] =   '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
         $html[] =       '<div class="form-wizards-wrap">';
         $html[] =           '<div class="form-wizards-element">';
-        $html[] =               '<textarea ' . GeneralUtility::implodeAttributes($attributes, true) . '>';
-        $html[] =                   htmlspecialchars($itemValue);
-        $html[] =               '</textarea>';
+        $html[] =               '<textarea ' . GeneralUtility::implodeAttributes($attributes, true) . '>'. htmlspecialchars($itemValue) . '</textarea>';
         $html[] =           '</div>';
         $html[] =           '<div class="form-wizards-items-aside">';
         $html[] =               '<div class="btn-group">';

Actions

Also available in: Atom PDF