Skip to main content
Inspiring
October 9, 2009
Answered

How to get rid of extra <p> and &nbs tags from <cftextarea>

  • October 9, 2009
  • 1 reply
  • 993 views

Hi,

I'm using richtext in a cftexarea and when the data is inserted into the db, the data is wrapped in <p> and a bunch of <br> tags.  How can I strip this field to only insert the data.  I've used the Trim function when inserting the data and that doesn't seem to strip the characters.

I've also used just plain text <textarea> also, the problem with that is that the data shows up with a bunch of spaces in front of it.

I have an edit page where if there is data in the db table to populate the <textarea> and the way it displays is such:

space, space,space, space THE VALUE OF THE FIELD. space, space,space, space.  Eventhough I've used that trim function with that as well

<cftextarea richtext=true name="location" toolbar="Basic"><cfoutput>#Trim(location)#</cfoutput></cftextarea>

Any ideas as to how I can resolve this?

This topic has been closed for replies.
Correct answer

You should be able to use the Replace() function. Give this a shot.

<cfset myTextAreaValue = Replace(location,"<br>","","all") />

<cfset myTextAreaValue = Replace(location,"<p>","","all") />

1 reply

Correct answer
October 9, 2009

You should be able to use the Replace() function. Give this a shot.

<cfset myTextAreaValue = Replace(location,"<br>","","all") />

<cfset myTextAreaValue = Replace(location,"<p>","","all") />

jenn1Author
Inspiring
October 9, 2009

That's exactly what I did.  Thanks!

I was hoping that with CF8 the text editor would be smart enough to strip those extra characters.