Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disappearing "< >" Characters

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

In ColdFusion MX (6.1) when I have a less than or greater than characters (< >) in my form fields (both text and textarea) they display OK but when I try to display it using base HTML they "disappear".

What can I do to fix this?

Thanks,

Michael42
 
What do you mean by base html? you mean if you include an angled bracket in HTML its not displayed ? what if you try &lt;
 
pigsie,

Thanks for the response.

If I have an html form and it contains: < or > I can see these characters is the form tags.

If I output the values of these fields using <cfoutput>, I see all characters in the fields EXCEPT < and > characters.

I guess I was hoping\looking for a ColdFusion function to retain these. In SQL for example, ColdFusion sometimes removes single quotes so I use the CF function preserveSingleQuotes().

What can you recommend in this case?

Thanks,

Michael42
 
if you type something like

this is my <would be> new car

the browser is going to assume you're trying to use a "would" tag. as we know browsers ignore tags they don't understand. you should get "this is my new car" in the web page. however if you look at the source you'll see the whole thing.

when you save it to the db you should replace < and > with &lt; and &gt; to work properly. if you also have html in there... well... don't do stuff like the above example...

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Use the following instead of just outputting the variable directly to screen:

Code:
#HTMLEditFormat(StringName)#

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top