JavaScript/ASP textarea value set to cookie but loses formatting

C

Chris Kennedy

I am writing the value from a textarea input box to a cookie. Long
story but when I return to the page I want to pull the value from the
cookie and put it back in the textbox. When I do this all the
linebreaks and spaces are removed.

Here is the longer version of the problem if it helps.

Essentially I have a page which sends some form infomation to an ASP
page via sometimes a querystring and sometimes a form. This can happen
several times before the final submit is pressed and the form is sent.
In order to keep the information typed in the text box I assign to a
cookie (it could very long). And write it back when returning to the
page. This works fine via the form and when set via ASP. But when the
page is left and returned to via the querystring I can't send the
contents of the text box via a querystring as it is too long. Hence I
set a cookie in Javascript. When I write it back it loses all the
linebreaks and spaces are removed.
 
M

Michael Winter

Chris Kennedy wrote on 12 Dec 2003 at Fri, 12 Dec 2003 17:26:24
GMT:
I am writing the value from a textarea input box to a cookie.
Long story but when I return to the page I want to pull the
value from the cookie and put it back in the textbox. When I do
this all the linebreaks and spaces are removed.

<snipped longer version>

Are you escaping the value before storing the value? I don't know if
it will necessarily help, but it seems a good place to start. Use the
escape and unescape functions.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top