Closed
Bug 549278
Opened 14 years ago
Closed 13 years ago
Adding lines with DOM to a textarea is not working as expected
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: capape_gil, Unassigned)
References
Details
Attachments
(1 file)
755 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB6 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB6 (.NET CLR 3.5.30729) I'm trying to fill a text area with new lines. But when I add a new line CRLF (HTML line terminator for multi-line elements) using DOM, the new line is CR ended. Then if I post this data to an action, it sends a single line value. Reproducible: Always Steps to Reproduce: 1.Save the following code as a html page. <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Insert title here</title> </head> <body> <form id="form-textarea" method="post" action=""> <textarea id="area" name="area"></textarea> <input type="button" onclick="enviar()" value="Enviar" /> </form> <script type="text/javascript"> //<![CDATA[ function enviar() { document.getElementById("area").value="hola\u000d\u000aadios" ; alert(escape(document.getElementById("area").value)); } //]]> </script> </body> </html> 2. Press button "Enviar" 3. Actual Results: Alert with hola%0Aadios Expected Results: Alert with hola%0D%0Aadios
Reporter | ||
Updated•14 years ago
|
Version: unspecified → 3.6 Branch
Comment 1•14 years ago
|
||
Reporter | ||
Comment 2•14 years ago
|
||
Sorry I said CR ended when it's LF ended
Comment 3•13 years ago
|
||
Reporter, are you still seeing this issue with Firefox 3.6.13 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing. http://support.mozilla.com/kb/Safe+Mode http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2011-2-25]
Reporter | ||
Comment 4•13 years ago
|
||
I'm still seeing it in firefox 3.6.13, windows xp.
Updated•13 years ago
|
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Whiteboard: [CLOSEME 2011-2-25]
Version: 3.6 Branch → 1.9.2 Branch
Comment 5•13 years ago
|
||
Newlines in the DOM are always LF only. So the behavior is correct.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 6•13 years ago
|
||
Thanks a lot. It's strange you can send the CRLF in a form with a textarea, but you can't assign it by DOM to a textarea and send it. I'll take it into account.
Comment 7•13 years ago
|
||
If you put an LF in a textarea it should become a CRLF when the form is submitted, if you're on Windows.
Reporter | ||
Comment 8•13 years ago
|
||
Sorry. Last comment, I didn't mention that I'm using and XMLhttprequest to send data. In the application we found the problem we copied data from one textarea to another, and finally we sent the form with ajax. I believed then it was a problem with textarea. Now I see we have to manage this situations before sending the request. My apologies and thanks again.
You need to log in
before you can comment on or make changes to this bug.
Description
•