Alex Rivera | Logout

How to define ColdFusion functions with the access="remote" attribute using scripting?

Asked 2011-04-06T09:39:45.310
9

The goal is to allow the definition of all functions of a .cfm or .cfc using scripting rather than CFML tags.

I would like to change this:

<cffunction name="foo" access="remote">
    <cfscript>
        ....
    </cfscript>
</cffunction>

Into something like this:

<cfscript>
    function remote foo() {
        ....
    }
</cfscript>

Or something else, as long as it can be done within opening and closing cfscript tags.

Edit
Report

1 Answer

16

Not possible in CF8, made possible in CF9:

access returnType function functionName(arg1Type arg1Name="defaultValue1" arg1Attribute="attributeValue...,arg2Type arg2Name="defaultValue2" arg2Attribute="attributeValue...,...) functionAttributeName="attributeValue" ... { body contents }

Defining components and functions in CFScript

So your function would look similar to:

<cfscript>
    remote function foo() {
        ...
    }
<cfscript>
answered 2011-04-06T09:56:47.937

Your Answer