By named parameters. 

<cfset result = obj.testmethod(argument1 = 0, argument2 = 1, argument3 = 10)
/>

Offcourse the argument name has to match the name in the method.

> <cfif arguments.arg neq "">do this</cfif>
> Firstly is it a good idea to do this in a CFC?

Not sure what to answer here, I know in OOP it's a bad thing to have
switches and if's in a method.
Maybe your better off creating another method?
It's a shame we can't overload methods like in Java :-(

-- 
Taco Fleur
Senior Web Systems Engineer
http://www.webassociates.com


-----Original Message-----
From: Paul Wilson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 1 December 2004 9:20 AM
To: CF-Talk
Subject: CFC required arguments

I'm using createObject to invoke a CFC and one of the methods in the CFC
takes a number of arguments, all numeric but not all required. In the CFC I
have some conditional statements that do various things based on the
arguments passed in.

<cfif arguments.arg neq "">do this</cfif>

 Firstly is it a good idea to do this in a CFC? And secondly, how can I pass
is the only the arguments required .e.g.

<cfset result = obj.testmethod(0,1, ,10)

The third argument is not required but this will throw an error. This
situation doesn't arise when you use cfinvoke as you can simply miss out the
cfinvokeargument tag.

Thanks





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - New Atlanta
http://www.newatlanta.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185757
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to