• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Line breaks

LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

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.


TOPICS
Advanced techniques

Views

427

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

Here is how I do it in one of my apps.

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

Trevor
San Jose Semaphore Observations

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

Seems to have worked.

I am using Flash forms and I am not sure if they are including #chr(13/10)#
into the database. I just tried entering text into a flash form and it didnt
work. Just another posting added an additional link break. \

hmm


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

Here is how I do it in one of my apps.

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

Trevor

And if you would like true paragraphs, not just breaks.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

Actually now it works fine. Since the example you gave me had 2 items in it,
I change it from replace() to replaceList() and it works perfectly

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

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


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2006 Nov 13, 2006

Copy link to clipboard

Copied

LATEST
even better 🙂


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation