User Guide

cffunction 181
Usage
The cffunction tag can define a function that you call in the same manner as a ColdFusion
built-in function.
To define a ColdFusion component (CFC) method, you must use a
cffunction tag.
The following example shows
cffunction tag attributes for a simple CFC method that returns a
ColdFusion Query object.
<cffunction
name="getEmployees"
access="remote"
returnType="query"
hint="This query returns all records in the employee database. It can
drill-down or narrow the search, based on optional input parameters.">
access Optional public The client security context from which the method can
be invoked:
private: available only to the component that declares
the method and any components that extend the
component in which it is defined.
package: available only to the component that
declares the method, components that extend the
component, or any other components in the package.
public: available to a locally executing page or
component method.
remote: available to a locally or remotely executing
page or component method, or a remote client
through a URL, Flash, or a web service. To publish the
function as a web service, this option is required.
description Optional Supplies a short text description of the function.
output Optional Function
body is
processed
as standard
CFML
Specifies under which conditions the function can
generate HTML output.
yes: the entire function body is processed as if it were
within a
cfoutput tag. Variables names surrounded by
number signs (#) are automatically replaced with their
values.
no: the function is processed as if it were within a
cfsilent tag
If you do not specify this attribute, the function body is
processed as standard CFML. Any variables must be in
cfoutput tags.
displayname Optional Meaningful only for CFC method parameters. A value to
be displayed in parentheses following the function name
when using introspection to show information about the
CFC.
hint Optional Meaningful only for CFC method parameters. Text to be
displayed when using introspection to show information
about the CFC. The
hint attribute value follows the
syntax line in the function description.
Attribute Req/Opt Default Description