Hi all - hope someone can help.
I have a JSP with a description field which is a textarea.
I pass into the JSP the value I want displayed.
If this string has a carriage return in it, it throws a JavaScript error (Unterminated String Constant) when I try to set the value of the text box...
ie
String is "This is
the description"
in the jsp - (note - typed, not actual code so ignore any code errors)
var str = request.getParameter("desc");
mytextbox.value = str;
In the html, this looks like
mytextbox.value = "This is
the description"
How can I escape the carraige return so that it dosnt cause the error?
D
I have a JSP with a description field which is a textarea.
I pass into the JSP the value I want displayed.
If this string has a carriage return in it, it throws a JavaScript error (Unterminated String Constant) when I try to set the value of the text box...
ie
String is "This is
the description"
in the jsp - (note - typed, not actual code so ignore any code errors)
var str = request.getParameter("desc");
mytextbox.value = str;
In the html, this looks like
mytextbox.value = "This is
the description"
How can I escape the carraige return so that it dosnt cause the error?
D