Skip to main content
Known Participant
August 13, 2008
Answered

Escaping bgcolor="#B03F15" in a CFOUTPUT

  • August 13, 2008
  • 3 replies
  • 513 views
Hi everyone,
I have some code that works great until I add some color to a table I am outputting. I think it is because the color has a "#" in it, which CF interperets as a variable. How can I escape that "#" and so the color shows and I don't get an error? Thanks!

<cfoutput query="getNotes">

<table width="100%" border="1">
<tr>
<th width="90" scope="col"> <div align="center" >#DateFormat(getNotes.date)#</div></th>
<th width="860" scope="col" bgcolor="#B03F15"><div align="left">#getNotes.description#</div></th>
</tr>
</table>
</cfoutput>
This topic has been closed for replies.
Correct answer -__cfSearching__-
A quick google on ColdFusion escape # signs reveals many links, such as:

http://www.sitepoint.com/article/get-started-coldfusion/2
http://www.mximize.com/how-can-i-put-a-pound-sign-in-my-coldfusion-output-

3 replies

Known Participant
August 13, 2008
Just to clarify to everyone: Just use a ## instead of # to escape. Thank you cfSearching. I actually did google it but I couldn't quite put my finger on what to search FOR. Thanks again
-__cfSearching__-Correct answer
Inspiring
August 13, 2008
Inspiring
August 13, 2008
freedomflyer wrote:
> How can I escape that "#" and so the color shows and
> I don't get an error? Thanks!
>

You escape ColdFusion control characters by doubling them.

<th ... bgcolor="##B01F15">