Textarea Inside of a textarea

Discussion in 'ASP General' started by wperry1@gmail.com, Feb 4, 2006.

  1. Guest

    I am writing a small database utility to catalog all of my favorite
    ASM/JS/VBS... functions and scripts on an asp page. Everything is going
    smoothly except for one thing that I can't quite seem to think my way
    around.

    I am using a <textarea> to display the code but some of my scripts have
    <textarea> tags in them and when the </textarea> tag is entered, it
    closes my <textarea> and the rest of the code ends up outside of the
    textarea.

    Example: (the code after the middle </textarea> show up outside of the
    textarea box)

    <textarea>
    code...code...code...
    code...<textarea></textarea>code...
    code...code...code...
    </textarea>

    Anyone Got any Ideas? The page/code that is giving me a headache is
    here...
    http://www.wperry.net/projects/codelib/detail.asp?id=19
     
    , Feb 4, 2006
    #1
    1. Advertising

  2. <textarea>
    <%=Server.HTMLEncode(varMyContent)%>
    </textarea>

    Anthony.
     
    Anthony Jones, Feb 4, 2006
    #2
    1. Advertising

  3. McKirahan Guest

    <> wrote in message
    news:...
    > I am writing a small database utility to catalog all of my favorite
    > ASM/JS/VBS... functions and scripts on an asp page. Everything is going
    > smoothly except for one thing that I can't quite seem to think my way
    > around.
    >
    > I am using a <textarea> to display the code but some of my scripts have
    > <textarea> tags in them and when the </textarea> tag is entered, it
    > closes my <textarea> and the rest of the code ends up outside of the
    > textarea.
    >
    > Example: (the code after the middle </textarea> show up outside of the
    > textarea box)
    >
    > <textarea>
    > code...code...code...
    > code...<textarea></textarea>code...
    > code...code...code...
    > </textarea>
    >
    > Anyone Got any Ideas? The page/code that is giving me a headache is
    > here...
    > http://www.wperry.net/projects/codelib/detail.asp?id=19
    >


    Dim s
    s = "code...code...code..." & vbCrLf
    s = s & "code...<textarea></textarea>code..." & vbCrLf
    s = s & "code...code...code..." & vbCrLf
    s = Replace(s,"<","&lt;")
    s = Replace(s,">","&gt;")


    <textarea><%=s%></textarea>
     
    McKirahan, Feb 4, 2006
    #3
  4. Will Guest

    Anthony Jones wrote:
    > <textarea>
    > <%=Server.HTMLEncode(varMyContent)%>
    > </textarea>
    >
    > Anthony.


    This is essentilaly what I am doing now. The problem is that when
    varMyContent contains <textarea></textarea> the </textarea> closes the
    textarea tag that is supposed to contain the code.
     
    Will, Feb 4, 2006
    #4
  5. Will Guest

    McKirahan wrote:
    > <> wrote in message
    > news:...
    > > I am writing a small database utility to catalog all of my favorite
    > > ASM/JS/VBS... functions and scripts on an asp page. Everything is going
    > > smoothly except for one thing that I can't quite seem to think my way
    > > around.
    > >
    > > I am using a <textarea> to display the code but some of my scripts have
    > > <textarea> tags in them and when the </textarea> tag is entered, it
    > > closes my <textarea> and the rest of the code ends up outside of the
    > > textarea.
    > >
    > > Example: (the code after the middle </textarea> show up outside of the
    > > textarea box)
    > >
    > > <textarea>
    > > code...code...code...
    > > code...<textarea></textarea>code...
    > > code...code...code...
    > > </textarea>
    > >
    > > Anyone Got any Ideas? The page/code that is giving me a headache is
    > > here...
    > > http://www.wperry.net/projects/codelib/detail.asp?id=19
    > >

    >
    > Dim s
    > s = "code...code...code..." & vbCrLf
    > s = s & "code...<textarea></textarea>code..." & vbCrLf
    > s = s & "code...code...code..." & vbCrLf
    > s = Replace(s,"<","&lt;")
    > s = Replace(s,">","&gt;")
    >
    >
    > <textarea><%=s%></textarea>


    I though for sure that I would end up with the escape codes displayed
    in the text area if I did it tis way but I read your post and decided
    to try it. It works like a charm.

    Thanks a lot.
     
    Will, Feb 4, 2006
    #5
  6. Bob Lehmann Guest

    Then you are doing something wrong.

    <%
    var = "<textarea> some stuff</textarea>"
    %>
    <form method=post action="">
    <textarea name="" rows="20" cols="40"><%=server.htmlencode(var)%></textarea>
    </form>

    Bob Lehmann

    "Will" <> wrote in message
    news:...
    >
    > Anthony Jones wrote:
    > > <textarea>
    > > <%=Server.HTMLEncode(varMyContent)%>
    > > </textarea>
    > >
    > > Anthony.

    >
    > This is essentilaly what I am doing now. The problem is that when
    > varMyContent contains <textarea></textarea> the </textarea> closes the
    > textarea tag that is supposed to contain the code.
    >
     
    Bob Lehmann, Feb 5, 2006
    #6
  7. Will,

    Seriously, why are you not using Server.HTMLEncode ???

    What happens if you code contains &? That also needs escaping.

    Anthony.
     
    Anthony Jones, Feb 5, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Logical
    Replies:
    9
    Views:
    1,640
    Mark Parnell
    Aug 2, 2004
  2. Augustus
    Replies:
    1
    Views:
    384
    Ken Schaefer
    Sep 10, 2003
  3. Hans

    Capture keypress inside a textarea

    Hans, Jun 23, 2004, in forum: Javascript
    Replies:
    1
    Views:
    108
    Martin Honnen
    Jun 24, 2004
  4. Liming
    Replies:
    0
    Views:
    209
    Liming
    Aug 26, 2005
  5. Replies:
    1
    Views:
    344
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page