JavaScript/ASP textarea value set to cookie but loses formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Kennedy

    #1

    JavaScript/ASP textarea value set to cookie but loses formatting

    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.
  • Michael Winter

    #2
    Re: JavaScript/ASP textarea value set to cookie but loses formatting

    Chris Kennedy wrote on 12 Dec 2003 at Fri, 12 Dec 2003 17:26:24
    GMT:
    [color=blue]
    > 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.[/color]

    <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

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk")

    Comment

    Working...