Re: CFC required arguments

2004-12-01 Thread Barney Boisvert
> > > > -Original Message- > From: Barney Boisvert [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 30, 2004 6:26 PM > To: CF-Talk > Subject: Re: CFC required arguments > > If you use positional parameters, only parameters at the end can be > left off. Ho

RE: CFC required arguments

2004-12-01 Thread Sparrow-Hood, Walter
Barney, I'm curious - why do you prefer structKeyExists() vs. setting default values? Walt -Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 6:26 PM To: CF-Talk Subject: Re: CFC required arguments If you use positional param

Re: CFC required arguments

2004-11-30 Thread Sean Corfield
On Wed, 1 Dec 2004 10:20:27 +1100, Paul Wilson <[EMAIL PROTECTED]> wrote: > do this If they are numeric arguments, you shouldn't have an empty string as the default. As other have hinted, specify required="false" but do not specify a default= value. Then you can test structKeyExists(arguments,'a

RE: CFC required arguments

2004-11-30 Thread Taco Fleur
Another option is to use the argumentCollection, i.e. obj.method( argumentCollection = structureContainingAllRequiredArguments ) Example: variables.argumentCollection = structNew(); variables.argumentCollection.argument1 = form.argument1; variables.argumentCollection.argument2 = url.argument2; va

Re: CFC required arguments

2004-11-30 Thread Spike
Another alternative is to use named arguments. assuming your function is defined as: On Wed, 1 Dec 2004 10:20:27 +1100, Paul Wilson wrote: > > >>> >>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 o

RE: CFC required arguments

2004-11-30 Thread Taco Fleur
By named parameters. Offcourse the argument name has to match the name in the method. > do this > 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? I

Re: CFC required arguments

2004-11-30 Thread Barney Boisvert
If you use positional parameters, only parameters at the end can be left off. However, you can use named parameters without using CFINVOKE: I generally prefer to not specify a default for my option arguments, and then use structKeyExists() against the 'arguments' struct to check if they were pa

Re: CFC required arguments

2004-11-30 Thread Scott Brady
On Wed, 1 Dec 2004 10:20:27 +1100, Paul Wilson wrote: > > 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. > Generally in the CFC, I list the required arguments first an