Skip to main content
Inspiring
November 13, 2006
Question

Line breaks

  • November 13, 2006
  • 1 reply
  • 495 views
Is there a better code practive for CF to both include and show line breaks
in text areas.

I have many sites that have text areas inwhich users use the enter key to
seperate their paragraphs.

When I go to show them on a page, it all gets pushed together into one long
paragraph.

On some sites I use MySQL and on others I use MS SQL although I have
accomplished this in Classic ASP (with help from an extension) using both so
I don't think it is a DB issue.

The goal is to be able to display parapgraphs as the user has entered them

I have tried <code></code> and <pre></pre> and those did not quite work.

Thanks for any help.

Example / Goal:

I would like to have a paragraph like this.

And this.

Rather than:
I would like to have a paragraph like this. And this.


This topic has been closed for replies.

1 reply

Inspiring
November 13, 2006
Store what you get. This will make it easier for you to pre-populate the textarea should that be necessary.

When you are displaying the info, use the replace function to change all the chr(10)s to <br />s

Inspiring
November 13, 2006
Here is how I do it in one of my apps.

#replace('#posting#', '#chr(13)##chr(10)#', '<br/>', 'all')#

Trevor
San Jose Semaphore Observations