Bug #94516
open<textarea> is losing empty lines on the beginning
0%
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
Updated by Torben Hansen over 3 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.
Updated by Riccardo De Contardi over 1 year ago
- File clipboard-202305131217-sroxg.png clipboard-202305131217-sroxg.png added
- File clipboard-202305131219-ebmoa.png clipboard-202305131219-ebmoa.png added
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
Updated by Riccardo De Contardi 5 months ago
This issue is still present on 13.3.0-dev (latest main)