User Guide

374 CFML Language Reference
HTMLCodeFormat
Returns HTML escaped string enclosed in <PRE> and </PRE> tags. All carriage returns
are removed from string, and all special characters (> < " &) are escaped.
See also HTMLEditFormat.
Syntax HTMLCodeFormat(
string
[,
version
])
string
String being HTML escaped and preformatted.
version
The specific HTML version to use in replacing special characters with their entity
references. Valid entries are:
-1 — The latest implementation of HTML
2.0 — For HTML 2.0 (Default)
3.2 — For HTML 3.2
Example <!--- This example shows the use of HTMLCodeFormat
and HTMLEditFormat --->
<HTML>
<HEAD>
<TITLE>
HTMLCodeFormat Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>HTMLCodeFormat Example</H3>
<FORM ACTION="HTMLcodeformat.cfm" METHOD="POST">
Try entering a URL for the tag to return in HTMLCodeFormat
and HTMLEditFormat:
<INPUT TYPE="Text" size=25 NAME="urladdress"
VALUE="http://www.allaire.com">
<INPUT TYPE="Submit" NAME="" VALUE="get page">
</FORM>
<!--- sets a default value for a url to retrieve --->
<CFPARAM NAME="urladdress" DEFAULT="http://localhost/cfdocs/index.htm">
<!--- if we have passed a url address in the FORM, we
want to display the passed address --->
<CFIF IsDefined("FORM.urladdress") is True>
<!--- do simple error check to avoid crashing the tag --->