CFAjax: What it is and How to Use it - Implemented ColdFusion Function
(Page 2 of 5 )
The following ColdFusion function, 'test_this ()' will be implemented using the tags <cffunction/>. Put simply, this function takes two arguments, x and y. The function produces the result, which is the square root of summing the values of x * x and y * y.
<cffunction name="test_this">
<cfargument name="x" required="yes" type="numeric">
<cfargument name="y" required="yes" type="numeric">
<cfset result=sqr(#x#*#x#+#y#*#y#)>
<cfreturn result>
</cffunction>
This function may be tested with the following statement added to the above. The resulting CFM file TestThis.cfm calls the function 'test_this' passing the arguments 3 and 4 to the function. The browser output for this is shown in the next picture. Five is the correct answer for square root of (3^ 2 + 4 ^ 2).
<cfoutput>
#test_this("3","4")#
</cfoutput>

Next: CFAjax implementation of a ColdFusion function >>
More ColdFusion Articles
More By Jayaram Krishnaswamy