Outputting text that was collected via textarea

Discussion in 'HTML & Website Design' started by tbarr60, Mar 5, 2007.

  1. #1
    I am trying to out put some text collected from a form textarea but it doesn't display well. I am losing the line breaks or not getting word wrap to happen.

    I lose all the line breaks if i output without any format. If I use <PRE> tags the text goes very wide (no word wrap occurs).

    The site uses ColdFusion and style sheets and is viewed primarily in IE.
     
    tbarr60, Mar 5, 2007 IP
  2. crazybjörn

    crazybjörn Peon

    Messages:
    270
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try something like:

    pre {
    white-space: pre-wrap; /* CSS2.1 compliant */
    white-space: -moz-pre-wrap; /* Mozilla-based browsers */
    white-space: -o-pre-wrap; /* Opera 7+ */
    }

    in your stylesheet and use <pre>, though if you use coldfusion you could just have it insert the <br />'s for you?
     
    crazybjörn, Mar 6, 2007 IP
  3. tbarr60

    tbarr60 Notable Member

    Messages:
    3,455
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    210
    #3
    Thanks for the CSS, I had tried something with white-space but was unaware of the pre-wrap parameter. You provided more information than the CSS book I own. :)

    In the mean time I did find some old ColdFusion code to find carriage return and line feed (chr(13) & chr(10)) replace a <br /> as you said:

    #Replace(qQuestion.sQuestionText,chr(13) & chr(10),'<br>','ALL')#
    Code (markup):
    Thanks.
     
    tbarr60, Mar 6, 2007 IP