I have a ColdFusion function "foo" which takes three args, and the second two are optional:
<cffunction name="foo" access="public" returntype="any">
<cfargument name="arg1" type="any" required="true" />
<cfargument name="arg2" type="any" required="false" default="arg2" />
<cfargument name="arg3" type="any" required="false" default="arg3" />
...
<cfreturn whatever />
</cffunction>
I want to call foo, passing in arg1 and arg3, but leaving out arg2. I know that this is possible if I call the function using cfinvoke
, but that syntax is really verbose and complicated. I have tried these two approaches, neither works:
<cfset somevar=foo(1, arg3=3) /> <!--- gives syntax error --->
<cfset somevar=foo(1, arg3:3) /> <!--- gives syntax error --->