Formatting Text Entered into a Text Area

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Formatting Text Entered into a Text Area

    I have a web application on a site I am working on that the staff can enter
    their bio into and it posts it with their contact information.

    The form is just a text box and a couple of hidden fields for userid and such.
    If the user were to create paragraphs in the text area and save it to the
    database the line breaks are not saved with it.

    When the viewDetails.cfm page pulls the data from the database and inserts it
    into the html of the page it creates a continuous block of text.

    Is it possible to replace the line breaks in the text area with the
    appropriate <br /> So that when the viewDetails.cfm page shows the data it can
    render the page breaks?

    I am having trouble deciding if i am explaining this clearly so if there are
    any questions, please ask.

    Thank you all!

    Josh

    jeby Guest

  2. Similar Questions and Discussions

    1. Coursebuilder - 5 text areas for 5 possible scores. Eachpossible answer has its own text area
      I'm trying to build an inventory form that has different point values for each possible answer for a particular question. there will be 5 possible...
    2. Text Area formatting
      Good morning, I have been experimenting with Flash /XML integration, using some of the various components in MX2004 Pro. Essentially my app pulls...
    3. text area resizing stretches inherent text
      when i want to resize a text area the text in it stretches depending to the size. the result is ugly warped text (they are horizontally/vertically...
    4. Text in the work area vs. text in the Flash movie
      Even when I use any font even the default _sans serif font, the size, scale and location of the letters are not the same in the published movie (or...
    5. [PHP] Input area allowing text formatting
      http://www.interactivetools.com/products/htmlarea/ this is not concerning php but javascript -----Mensaje original----- De: Todd Cary Enviado...
  3. #2

    Default Re: Formatting Text Entered into a Text Area

    If the information is added into the database with carriage returns you can use this function:

    #Replace(fieldname,"#chr(10)#","<br>","all")#
    jmoshier Guest

  4. #3

    Default Re: Formatting Text Entered into a Text Area

    You can also try:
    <cfoutput>
    <PRE> #TextField#</PRE>
    </cfoutput>
    OldCFer Guest

  5. #4

    Default Re: Formatting Text Entered into a Text Area

    The carriage returns are actually saved in the database, it is just that HTML
    considers all carriage returns and spaces to count as one space. So as jmoshier
    rightly points out you can either use replace to add the break tags and insert
    it into your database, or you can add the break tags when you output the each
    profile. I would stump for the first of the two if I were you.

    Stressed_Simon Guest

  6. #5

    Default Re: Formatting Text Entered into a Text Area

    You can use this function in your output:
    ParagraphFormat(fieldname)

    It will add a <P> tag to paragraph breaks in your text (CR/LF and then a blank
    line and another CR/LF). You could tell users on the form to leave a blank line
    between paragraphs.

    The Replace option would also work if you want an HTML line break at all CR/LF
    breaks in the text.

    -Paul


    dempster Guest

  7. #6

    Default Re: Formatting Text Entered into a Text Area

    I suggest you don't store the break tags in the database unless you're
    absolutely sure
    the data will never be used for anything but HTML display. If it needs to be
    edited in a
    text area or, accessed by another application, then all of those annoying
    break tags will
    be embedded in the text.

    OldCFer Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139