View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > ParagraphFormat PreviousNext

ParagraphFormat

Replaces characters in a string:

A copy of the string, with characters converted.

Display and formatting functions, String functions

ParagraphFormat(string)

StripCR

Parameter

Description

string

A string or a variable that contains one

This function is useful for displaying data entered in textarea fields.

<h3>ParagraphFormat Example</h3>
<p>Enter text into this textarea, and see it returned as HTML.
<cfif IsDefined("FORM.myTextArea")>
   <p>Your text area, formatted
   <p><cfoutput>#ParagraphFormat(FORM.myTextArea)#</cfoutput>
</cfif>
<!--- use #Chr(10)##Chr(13)# to simulate a line feed/carriage
return combination; i.e, a return --->
<form action = "paragraphformat.cfm">
<textArea name = "MyTextArea" cols = "35" ROWS = 8>
This is sample text and you see how it scrolls
<cfoutput>#Chr(10)##Chr(13)#</cfoutput>
From one line
<cfoutput>#Chr(10)##Chr(13)##Chr(10)##Chr(13)#</cfoutput>
to the next </textArea> <input type = "Submit" name = "Show me the HTML version"> </form>

Contents > CFML Reference > ColdFusion Functions > ParagraphFormat PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


No screen name said on Oct 6, 2004 at 4:35 AM :
The output of this function will only validate against an HTML 4 doctype, as the XHTML specs say that all tags must be closed, thus: <p>foo</p>

If Macromedia would fix this function so that the end tag is always supplied the resulting code would validate with all versions of HTML/XHTML.

Ref: http://www.w3.org/TR/xhtml1/#h-4.1
extdw_doc said on Oct 7, 2004 at 11:23 AM :
Thanks for your feedback. For a request of this nature, however,
you should submit a Macromedia Feature Request/Bug Report Form:
http://www.macromedia.com/support/email/wishform/
to ensure that it will be reviewed by the ColdFusion engineering
group.
No screen name said on Jan 26, 2005 at 6:01 AM :
are you sereous there is no way to simply turn line breaks into <br> and vice versa? It seems pointless to have a formatparagraph if it doens't handle normal line breaks??
o'riyley said on Nov 6, 2006 at 2:27 PM :
A quick fix to inserting <br> tags into a string:
<div><cfoutput>#Replace(variable.string1, Chr(10), "<br/>", "all")#</cfoutput></div>

For some reason putthing Chr(10)Chr(13) together like so:
<div><cfoutput>#Replace(variable.string1, Chr(10)Chr(13), "<br/>", "all")#</cfoutput></div>
breaks and returns an error.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa49.htm