cfargument in cffunction
cfargument.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfargument tag example: how to use cfargument tag in cffunction tag</title>
</head>
<body>
<h2 style="color:Crimson">cfargument Tag Example</h2>
<cfoutput>
<b>Book Title [BookID 1]:</b> #GetBookTitleByID(1)#
<br />
<b>Book Title [BookID 10]:</b> #GetBookTitleByID(10)#
<br />
<b>Book Title [BookID 15]:</b> #GetBookTitleByID(15)#
<br />
<b>Book Title [BookID 20]:</b> #GetBookTitleByID(20)#
</cfoutput>
<cffunction name="GetBookTitleByID" access="remote" returntype="string" description="Return Book Title by ID">
<cfargument name="BookID" type="numeric" required="yes">
<cfquery name="qBook" datasource="cfbookclub">
SELECT Title FROM BOOKS
WHERE BookID=#arguments.BookID#
</cfquery>
<cfreturn qBook.Title>
</cffunction>
</body>
</html>