Project

General

Profile

Actions

Bug #94516

open

<textarea> is losing empty lines on the beginning

Added by Albrecht Köhnlein almost 3 years ago. Updated 12 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2021-07-09
Due date:
% Done:

0%

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

Description

I had a case where I had to enter some text starting with multiple empty lines into FormEngine's textarea element.

When saving and re-opening the first empty line was missing in the editor. I investigated a little bit and found out, that the empty lines still exist when the data is saved to database and still exist in the rendered HTML when generating the form. But there seems to be any JavaScript which removes the first line.

This problem can be reproduced, if you enter some empty lines + a line of text in field tt_content.rowDescription or any other textarea.

When saving and reopening the form, you will see, there is one less empty line in the editor.


Files

Actions #1

Updated by Torben Hansen over 2 years ago

Pretty interesting bug. I observed the same bug in the PHP project "adminer" while trying to reproduce the problem. Actually, data gets written correct into the database and all new lines are preserved. When the saved data is used in a HTML textarea tag, it seems to be important to actually render the textarea with the data as following (simplified):

'<textarea>' . LF . 
$multiLineData .
'</textarea>'

It seems important to add a linefeed after the opening textarea tag.

The FormEngine Element TextElement actually renders the textarea as shown below:

'<textarea>' . $multiLineData . '</textarea>'

This leads to the described behavior when saving the record. I changed this locally as shown in the first example and then all new lines are shown correctly.

Actions #2

Updated by Albrecht Köhnlein over 2 years ago

  • Description updated (diff)

Updated by Riccardo De Contardi 12 months ago

This issue is still present on TYPO3 13.0.0-dev

Steps to reproduce it

1. Open a page
2. Edit the field "Notes > Description" ([rowDescription]) with the following:
- Leave 3 lines empty (hit 3 times carriage return) and then write something: you should see this:

3. Save it

Result:

One empty line is cut off:

Expected result

the field content should remain the same

Actions

Also available in: Atom PDF