Cannot invoke method foo on an object of type coldfusion.runtime.VariableScope with named arguments.

Use ordered arguments instead.

Sample code

<cffunction name="foo" returntype="boolean" output="false">
    <cfargument name="bar" required="false" />
    <cfreturn true />
</cffunction>

<cfscript>
    foo('Hello World'); // Works
    foo(bar = 'Hello World'); // Works
    variables.foo('Hello World'); // Works
    variables.foo(bar = 'Hello World'); // Doesn't work
</cfscript>

Explanation

Named arguments aren't allowed for user defined functions if you reference it by the scope it's in or if you copied it into a structure or array.

Although CFC's called with the same syntax do allow named arguments. cfcFunc.foo(bar = 'Hello World') works.

Submitted on Tuesday 7 October 2008

Comments

Add a comment or subscribe to this error