Defines functionality that you build in CFML.
<cffunction name = "methodName" returnType = "dataType" roles = "securityRoles" access = "methodAccess" output = "yes" or "no" >
cfargument, cfcomponent, cfinvoke, cfinvokeargument, cfobject, cfproperty, cfreturn
Components that are stored in the same directory are members of a component package.
Within a cffunction tag, if you specify the roles attribute, the method executes only if a user is logged in and belongs to one of the specified roles.
For more information, see the "Building and Using ColdFusion Components" chapter in Developing ColdFusion MX Applications with CFML.
The following example shows a typical use of this tag:
<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.">
<cfcomponent>
<cffunction name="getEmp">
<cfquery
name="empQuery" datasource="ExampleApps" >
SELECT FIRSTNAME, LASTNAME, EMAIL
FROM tblEmployees
</cfquery>
<cfreturn empQuery>
</cffunction>
<cffunction name="getDept">
<cfquery
name="deptQuery" datasource="ExampleApps" >
SELECT *
FROM tblDepartments
</cfquery>
<cfreturn deptQuery>
</cffunction>
</cfcomponent>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt145.htm
Comments
pfreitag said on Oct 7, 2002 at 5:12 AM : sundvor said on Jul 19, 2002 at 5:51 AM : pfreitag said on Aug 24, 2002 at 9:05 PM : mdunnOutlaw said on Sep 6, 2002 at 5:30 PM : mdunnOutlaw said on Sep 6, 2002 at 5:30 PM : igneous said on Sep 19, 2002 at 6:08 PM : pir2 said on Sep 29, 2002 at 7:15 PM : starrunner said on Dec 5, 2002 at 5:49 PM : starrunner said on Dec 5, 2002 at 5:52 PM : starrunner said on Dec 5, 2002 at 5:55 PM : drac123 said on Jul 17, 2003 at 7:21 PM : JamesC01 said on Sep 6, 2004 at 11:11 AM : No screen name said on Oct 25, 2007 at 3:39 PM :