Pound signs (#) have a special meaning in CFML. When the ColdFusion server encounters pound signs in CFML text, such as the text in a cfoutput
tag body, it checks to see if the text between the pound signs is either a variable or a function.
Is so, it replaces the text and surrounding pound signs with the variable value or the result of the function. Otherwise, ColdFusion generates an error.
For example, to output the current value of a variable named Form.MyFormVariable
, you delimit (surround) the variable name with pound signs:
<cfoutput>Value is #Form.MyFormVariable#</cfoutput>
In this example, the variable Form.MyFormVariable
is replaced with the value assigned to it.
Follow these guidelines when using pound signs:
1 + 2
in pound signs.The following sections provide more details on how to use pound signs in CFML. For a description of using pound signs to create variable names, see Using pound signs to construct a variable name in assignments