Skip to main content
December 30, 2010
Question

display html data in coldfusion

  • December 30, 2010
  • 3 replies
  • 3674 views

Hi All-

I have a database column whose values are anchor tags: <a href="http://www.website.com" target="_blank">

When I query the table and try to display the column, the value would not display. What could be the reason?

Thanks

This topic has been closed for replies.

3 replies

January 3, 2011

Do you have a close tag at the end? If so, put text in the middle, and you'll end up with a hyperlink.

<a href="http://www.yoursite.com">www.yoursite.com</a>

Then the www.yoursite.com will be clickable.

And now that I've said that, if all of the sites are http (as opposed to some being https) you could just put the www.yoursite.com in the database field and hard code the link portion.

<a href="http://#variable#">#variable#</a>

Michelle

Inspiring
December 30, 2010

If you want html code to appear on a web page, use the pre tag.

ilssac
Inspiring
December 30, 2010

Assuming Dan was trying to show how to display HTML code in the display in the browser.  The <pre> tag is not enough.

I.E.

<pre><a href='html-test.html">test</a></pre>

Will just display a link with "test"

On the other hand, using the htmlCodeFormat() function will escape the code and wrap it in <pre> tags for you so you DO see the HTML code.

ilssac
Inspiring
December 30, 2010

If that is the entire value in the database, there is nothing there that would display in a browser.  Though one should be able to see that html fragment if one where to view the source in the browser.