If you go that route, I'd offer up the suggestion of cleaning up the
extra # signs a bit.

<cfset newstring =
rereplace(rereplace(trim(form.mystring),"&quot;","""",
"all"),"#chr(13)#","<br>","all") />

just makes it a bit more readable (IMO).  and also God kills a kitty
every time you overuse pound signs :)

FWIW, regarding the quotes... instead of the nested rereplace, you
could just use HTMLEditFormat() to escape 'em on output... and if
you're using <cfqueryparam>, there'd be no issues with them during the
database operations (insert/update) :)

On 8/24/07, Matthew Smith <[EMAIL PROTECTED]> wrote:
> Thank you, Robert.  Exactly what I needed.
>
> -----Original Message-----
> From: Robert Harrison [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 24, 2007 11:42 AM
> To: CF-Talk
> Subject: RE: replace carriage returns
>
> How would I replace the carriage returns in a textarea entry with <br>?
>
> <cfset
> newstring='#REREPLACE("#REREPLACE("#Trim(form.mystring)#","&quot;","""",
> "all
> ")#","#chr(13)#","<br>","all")#'>
>
> This will do carriage returns and quotes to you can pass the data around
> in
> forms. Keep in mind, however, if you stick <br> into a DB and pull it
> back
> to a form for edits later, you need to convert the <br> back to carriage
> returns. The string below will do that:
>
> #REREPLACE("#myoutputstring#","<br>","#chr(13)#","all")#
>
> Hope that helps.
>
>
> Robert B. Harrison
> Director of Interactive services
> Austin & Williams
> 125 Kennedy Drive, Suite 100 Hauppauge NY 11788
> T : 631.231.6600 Ext. 119
> F : 631.434.7022
> www.austin-williams.com
>
> Great advertising can't be either/or... It must be &.
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287053
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to