Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4.5
-
IE6 / FF3.6 / Opera9
Description
When the content of a textarea starts with an empty line, this line disappears when it is placed in the html.
This is a known problem with the html textarea element.
<textarea>test</textarea> will result in the same as:
<textarea>
test</textarea>
Meaning that the first newline in the textarea is ignored. In case of opening a page with a textarea with a leading blank line, this line will be removed when the form is submitted again.
See for similar issues in the apache jira STR-1366 and BEEHIVE-1005
A possible solution is to change the following method in org.apache.wicket.markup.html.form.TextArea in something like:
protected final void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
checkComponentTag(openTag, "textarea");
String value = getValue();
if (value != null && value.startsWith("\n"))
else if (value != null && value.startsWith("\r\n"))
{ value = "\r\n" + value; }else if (value != null && value.startsWith("\r"))
{ value = "\r" + value; } replaceComponentTagBody(markupStream, openTag, value);
}