macromedia.coldfusion.getting_started
[Top] [All Lists]

Re: formatting textarea output

Subject: Re: formatting textarea output
From: Azadi
Date: Fri, 01 Feb 2008 09:04:54 +0700
Newsgroups: macromedia.coldfusion.getting_started


nickandjulie wrote:
I am new to this and would really appreciate two bits of advice.

1. I have a textarea that my client types into using the hard return key for paragraph breaks, but the output does not display the breaks and the text appears as one long block. How do I get the text to appear correctly on the website.

the 'hard return' is a non-prontable characers CR and LF, which are not rendered in the browsers. you need to replace those with html-specific line break - <br>.
one way to do it is
<cfset yourtext = replace(yourtext, "#chr(13)#", "<br>", "ALL")> - this will replace all CR characters with <br>; since LF characters (chr(10)) are not rendered in the browser they will not be shown. another way may be to treat your text as CRLF-delimited list and do listchangedelims(yourtext, "<br>", "#chr(13)##chr(10)#")

2. How do I get the B | I | U | etc icons that appear directly above the text box I am typing into here and put them on my own input page to format text in my text area..


a) if you are on cf8 use RICHTEXT attribute of <cftextarea> tag
b) if not, use a 3rd party html editor, like FCKeditor (the one used by cf8) or TinyMCE (my personal favourite)


---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

<Prev in Thread] Current Thread [Next in Thread>