Time:
Scotland: Fri, 9:58 pm
Rhode Island: Fri, 4:58 pm
Florida: Fri, 4:58 pm
New Mexico: Fri, 2:58 pm
California: Fri, 1:58 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information

For continued disscussion on this topic : Retriving certain escape characters in a textinput field


Cybian
02-08-2002, 02:12 AM
Hello all. At first this might seem as a ColdFusion problem but it is actually a client (browser) problem.

I have a content mangament system that users can create content for the site. I have some JavaScript buttons for users to add Quotes and the trademark symbol (TM) among other things. Everything uploads fine from the form to the database. The escape characters like " stay as the escape character in the SQL db.

My problem is when I try to edit the record and the form retrieves the info from the database. For certain escape characters, the browser will display the actually character. Example would be for ", now actually quotes are displayed in the textarea box. Same thing for the amp sign. Where & will be in the database, now when I query the record and display it in the textarea box of the form, the actually amp sign is shown.

Is there a script that will force raw HTML code to be displayed in the textarea box? That's great that my browser is trying to interpret raw HTML in the textarea box, but I do not want that.

Thanks in advance!

piglet
02-08-2002, 02:04 PM
Hi there,

Yes - I know the problem.

What you have to do is to convert the " retrieved from the database into & q u o t ; within your string you're putting into the textbox. I had to put spaces between the letters just then because of just the problem we're talking about! I'll type it with the spaces & q u o t ; and without: " !

When this is put into the textbox it's converted back to a " - and will be sent back to the server as a ".

You need to look out for all the escape characters " < > & etc in this way!

Unfortunately you have to work round what the browser will do with your HTML - you can't force it to do what you want.

Cybian
02-09-2002, 12:01 AM
OK ... I got it to work using ColdFusions CFSET and ReplaceList as so. Might not see the illegalcharacters but they are the same as htmlreplace without the spaces.

<CFSET illegalcharacters = "&quot;,&amp;">
<CFSET htmlreplace = "& q u o t ;,& a m p ;">

<TEXTAREA COLS="47" ROWS="20" NAME="Content"><CFOUTPUT QUERY="GetDetails">#ReplaceList(trim(Content),illegalcharacters,htmlreplace)#</CFOUTPUT></TEXTAREA>

So this works and I can see the htmlreplace in the textarea (which hopefully will not confuse some users). But now I guess I would have to get the spaces out before uploading back to the database.