Home> ColdFusion

ColdFusion Archive

Replacing “enter” key with “< br>” tag in Coldfusion

October 6, 2009 Category :ColdFusion| Web Devlopment 0

If you use PHP you know how easy is the workaround for this problem, you just need to use the nl2br function. In ColdFusion is a little bit different, they don’t have a specific function for that, so here is the workaround for it:

When grabbing the text from the database, instead just printing like this:

<cfoutput>
#form.comments#
</cfouput>

You can use this function to solve this problem:

<cfoutput>
#replace(form.comments,Chr(13),"<br>", "all")#
</cfouput>

,