
July 22nd, 2011, 05:55 PM
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 2
Time spent in forums: 37 m 29 sec
Reputation Power: 0
|
|
|
Replace /n with <br>, but only once...
Hi All, Developed some code to enable users to edit a webpage. Newlines are replaced with <br>. It works fine the first time. The problem is that the users can come back and update their comments - using the code below. And for some reason I end up with double <br> <br>. and probably triple on the next edit, etc. Any thoughts?
Thanks in advance,
<cfquery name="InsertCompany"
datasource="#Request.InventoryDSN#"
username="#Request.username#"
password="#Request.password#">
UPDATE Reports
SET
Comments = <cfif Len(Trim(Form.Comments)) GT 0>
'#ReReplace(Form.Comments, "\n", "<br>", "ALL")#'
<cfelse>
NULL
</cfif>
WHERE
ReportNumber = #ReportNumber#
</cfquery>
<cflocation url="ReportList.cfm">
|