User Guide

Table Of Contents
214 Chapter 10: Building and Using ColdFusion Components
The ColdFusion page or other client, such as a Flash application, that receives the result then uses
the variable data as appropriate.
Note: If a CFC is invoked using a URL or by submitting a form, ColdFusion MX returns the variable as
a WDDX packet. A CFC that is invoked by Flash Remoting MX, or any other instance of a CFC, must
not return the This scope.
You can return values of all data types, including strings, integers, arrays, structures, and instances
of CFCs. The
cfreturn tag returns a single variable, as does the return CFScript statement.
Therefore, if you want to return more than one result value at a time, use a structure. If you do
not want to display output in a method, use
output="false" in the cffunction tag.
For more information on using the
cfreturn tag, see CFML Reference.
Documenting CFCs
ColdFusion provides several ways to include documentation about your CFCs in your
component definitions. The documentation is available when you use introspection to display
information about the CFC or call the
GetMetadata function to get the components metadata.
You can use the following tools for documenting CFCs:
The displayname and hint attributes
User-defined metadata attributes
The cfproperty tag
The following sections describe these tools. For information on displaying the information, see
“Using introspection to get information about components” on page 236.
The displayname and hint attributes
The cfcomponent, cffunction, cfargument, and cfproperty tags have displayname and
hint attributes.
The
displayname attribute lets you provide a more descriptive name for a component, attribute,
method, or property. When you use introspection, this attribute appears in parentheses next to
the component or method name, or on the parameter information line.
You use the
hint attribute for longer descriptions of the component, method, or argument. In
the introspection display, this attribute appears on a separate line or on several lines of the
component or method description, and at the end of the argument description.
Metadata attributes
You can include arbitrary metadata information as attributes of the cfcomponent, cffunction,
cfargument, and cfproperty tags. To create a metadata attribute, specify the metadata attribute
name and its value. For example, in the following
cfcomponent tag, the Author attribute is a
metadata attribute. This attribute is not used as a function parameter; instead, it indicates who
wrote this CFC.
<cfcomponent name="makeForm" Author="Bean Lapin">