Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Line Breaks In A TextArea

    hey guys, i am having a problem when i insert a record from a textarea box, then preview the record on another page, there are no line breaks when i press enter... i have to manually type in <br> to bring up a line break, can someone please help me with the code. im using ASP VBScript, thanx guys..

    -Baleric

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,062
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Replace("yourString","vbCrLf","<br />")

  • #3
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    where do i place this script? and what do i place in Your string? do i place the name of the textbox?

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Location
    In front of this computer. (Where else?)
    Posts
    442
    Thanks
    0
    Thanked 0 Times in 0 Posts
    where do i place this script?
    You place it before the code that's displaying

    and what do i place in Your string?
    You place the value (contents) of the textbox
    Tomorrow is the first day of the rest of your life... What have you done today?
    Tutorials
    Web: w3schools, htmldog General tips: Hardware, Networking

  • #5
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    text areas use plain text formatting not html, so they use vbNewLine or vbCrLf instead of <br> (i prefer using vbNewLine as carriage return line feed means nothing to me .. i dont run my asp on a typewriter ... maby theres a difference on chillisoft *shrugs*)

    ideally you want to save the text as it was in the textarea, however, if you want it reloaded in a textarea you need to use
    Code:
    strTextData = Replace( Replace(strTextFromDB, "&", "&amp;") , "<", "&lt;")
    so it shows up properly in the textarea.. when this is submitted it needs to be changed back in the reverse order so it is stored properly.. pretty confusing if you do it wrong... which i did

    to reload it on a normal html page, now it is saved properly, you just need to use Replace(strTextFromDB, vbNewLine, "<br>")

  • #6
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,062
    Thanks
    4
    Thanked 8 Times in 8 Posts
    On the page you are displaying the field on, where myString is the field in your database, instead of using <%=rs("myString")%> use
    <%=Replace(rs("myString"), vbCrLf, "<br />")%>

  • #7
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank u so much for all ur help
    "much apreaciated"

    -Baleric


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •