Coldfusion functions code example

Example 1: cf function coldfusion

<cffunction name="getFullName" output="false" access="public" returnType="string">
    <cfargument name="firstName" type="string" required="false" default="" />
    <cfargument name="lastName" type="string" required="false" default="" />
 
    <cfset var fullName = arguments.firstName & " " & arguments.lastname />
 
    <cfreturn fullName />
</cffunction>
 
<cfset fullName = getFullName(firstName="John", lastName="Adams") />
 
<cfoutput>
    Good morning, #fullName#!
</cfoutput>

Example 2: cf function coldfusion

<cffunction
name = "method name"
access = "method access"
consumes="MIME types"
description = "function description"
displayName = "name"
httpMethod="GET|PUT|POST|DELETE"
hint = "hint text"
output = "yes|no"
produces="MIME type"
returnFormat = "not specified|JSON|plain|WDDX"
returnType = "data type"
roles = "securityRoles"
restPath="sub-resource path"
secureJSON = "yes|no"
verifyClient = "no|yes">

Tags:

Misc Example