Z
zjw2112
Hello. I have some javascript code that dynamically creates a textarea
and sets the wrap value to hard, which I thought would preserve CR/LF
in the textarea:
var otherTextArea = document.createElement("textarea");
otherTextArea.setAttribute("rows", "10");
otherTextArea.setAttribute("cols", "30");
otherTextArea.setAttribute("id", "otherTextArea");
otherTextArea.setAttribute("wrap", "hard");
At the appropriate time, I add the text string in the textarea to an
XML string using the following:
var textArea = document.getElementById("otherTextArea");
commentsXML += "<other>" + textArea.value + "</other>";
Using the following example, which would be in a textarea:
aaa
bbb
ccc
where 'aaa', 'bbb', and 'ccc' all have CR/LF after them, the number of
characters of textArea.value is 15, as expected. I have to send this
XML string to a JSP page for processing and return, therefore I use
AJAX to accomplish this. However, on the server-side of things, when I
get the length between
the XML string element <other>aaabbbccc</other>, the length is 9, i.e.
the CR/LF is not preserved. Does anyone know what I am doing wrong?
I've tried setting the wrap to off, but this didn't help either. Thank
you.
and sets the wrap value to hard, which I thought would preserve CR/LF
in the textarea:
var otherTextArea = document.createElement("textarea");
otherTextArea.setAttribute("rows", "10");
otherTextArea.setAttribute("cols", "30");
otherTextArea.setAttribute("id", "otherTextArea");
otherTextArea.setAttribute("wrap", "hard");
At the appropriate time, I add the text string in the textarea to an
XML string using the following:
var textArea = document.getElementById("otherTextArea");
commentsXML += "<other>" + textArea.value + "</other>";
Using the following example, which would be in a textarea:
aaa
bbb
ccc
where 'aaa', 'bbb', and 'ccc' all have CR/LF after them, the number of
characters of textArea.value is 15, as expected. I have to send this
XML string to a JSP page for processing and return, therefore I use
AJAX to accomplish this. However, on the server-side of things, when I
get the length between
the XML string element <other>aaabbbccc</other>, the length is 9, i.e.
the CR/LF is not preserved. Does anyone know what I am doing wrong?
I've tried setting the wrap to off, but this didn't help either. Thank
you.