Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text loses carriage returns

    I have created a basic page which allows a user to add and edit information that is stored in a database on the web server. One of the fields on this page is for text that the user pastes in from (I think) Word. The text contains and is formatted with carriage returns when it is pasted into the text field. The text still contains carriage returns when it is stored in the database. However, when the text is redisplayed in a web page, all the carriage returns appear to have gone (or been ignored) and the text displays as a great big ugly lump.

    I'm using the following to display the text:

    <%=(rstArticles.Fields.Item("ArticleText").Value)% >

    where ArticleText is the name of the field in the database.

    How do I get the text to retain/respond to its carriage returns when redisplayed?

    Ian

  2. #2
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text loses carriage returns

    Yes, thanks, I worked it out after submitting my post. I'm spending too much time with asp, I'm forgetting the basic facts of HTML.

    Ian

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Text loses carriage returns

    If you use a lower case br, the Lounge scripts "implement" it, but if you use an upper case BR, it is preserved somehow. Weird but useful for posts like the above.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text loses carriage returns

    I've always used a Replace function to display the Carriage Return character(s) with the < BR > tag:

    yourString.Replace(Chr(13),"< BR >")


    You'll have to check to see which carriage return characters are actually stored in the database (Chr(13), Chr(10), etc).

    Hope this helps

    EDIT: I added spaces between the "<" and "BR" and ">" to prevent the Lounge from displaying a break. (Thanks for the reminder, Jefferson.)

Posting Permissions

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