CFIF question

I'm sure this is really easy, probably some change which I don't know about, but here goes...

I have a home-grown CMS system that's worked GREAT for me these past 9 years.  Of course, it's gone through many upgrades over the years, but recently a CFIF statement issue arose.  

Over the years, I've used both FCK Editor and TinyMCE WYSIWYG textareas. With these, as many of you know, they automatically populate the textarea with this:

<p>&nbsp;</p>

Open in new window


If the user doesn't enter anything into the editor box, I don't want this code written to the database, so, I had the following CFIF identify and remove this code:

<cfif form.mytext eq '<p>&nbsp;</p>'><cfset form.mytext = ''></cfif>

Open in new window


Unfortunately, this stopped working (ANNOYING!!!)  I tried 'contains' instead of equal, but obviously that doesn't work if they have this code anywhere in their content.  I tried 'contains', then tried to trim off the first 13 characters...THEN see if there was anything in the field, but thought that was dumb, so I figured I'd post this as there was probably some change I haven't come across yet.

Any idea why this would have stopped working and what I should be using to catch and remove this code?
StellaBobAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

reitersCommented:
Without being able to see the data and code I can only guess that there is some kind of whitespace you are not seeing.  If you wrap trim around it, you will remove any whitespace before and after.  Keep the "eq" so it doesn't mess with real input that simply contains the text you are testing for.

<cfif trim(form.mytext) eq '<p>&nbsp;</p>'><cfset form.mytext = ''></cfif>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StellaBobAuthor Commented:
OK...you're the coolest!!!  I thought about spaces, but wasn't seeing ANYTHING before or after this.  But when I added the trim...ding, ding, ding...it worked!!!

Thank you very much.  I knew it would be something easy, but sometimes we are too close to see.  You made my day!!!
0
reitersCommented:
Glad I could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.