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 #1

Updated by Georg Tiefenbrunn over 7 years ago

Browser: Chrome 58.0.3029.81 (64-bit) on macOS 10.12.4

Actions #2

Updated by Wouter Wolters over 7 years ago

Would you mind pushing a patch to Gerrit?
https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/

If you have questions/problems just contact us on Slack in the #typo3-cms-coredev channel.

Actions #3

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52658

Actions #4

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52685

Actions #5

Updated by Henrik Elsner over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF