Pete,
As an alternative, we never use CFINVOKE. (But if we did use
CFINVOKE, we'd only use CFINVOKE).
In order to keep code consistent we always call the functions in the
same manner wether it has 0 or 10 arguments. If we have more than 2
or 3 arguments start using whitespace to your advantage. Break
arguments across lines like in the example below.
<cfscript>
// call method local to file for validating email address
var isValidEmail = checkEmail(arg1="[EMAIL PROTECTED]",
arg2="secondArg",
arg3="more than 2 args");
</cfscript>
Again, like Mike, this is a choice for developers or development
teams. Both ways will work correctly.
It's just an alternative, but the code ends up being more consistent
because code that does the same thing (function calls) all looks the
same.
Just my two cents,
t
On 8/23/05, Michael Dinowitz <[EMAIL PROTECTED]> wrote:
> My PERSONAL preferences is that if the method being calling has 0 or 1
> argument, then use a function call such as othermethod(). If it has 1 or more
> arguments, then use a <cfinvoke method="othermethod">. DO NOT USE a component
> argument in an internal CFINVOKE as it will invoke a new instance of the
> component. A CFINVOKE without a component argument assumes that it is a call
> to a local method.
>
> The times to use a CFINVOKE vs. a method call is all up to you based both on
> the method being called and the place where it is being called.
>
> >I hope this is a basic question.
> >
> >Let's say I have a CFC that does all of my email-related functions.
> >One of those methods (for example, insertEmail) needs to call another
> >method (for example, checkEmail) that is part of the same CFC. For
> >instance:
> >
> >CFCOMPONENT
> >CFFUNCTION NAME = CHECKEMAIL
> >(email address gets passed in as an argument, used to query the
> >database and see if the email address is (a) of valid format (OK, the
> >database isn't required for this) and (b) already exists in the
> >database)
> >CFRETURN SOME SORT OF INDICATOR OR MESSAGE
> >/CFFUNCTION
> >
> >CFFUNCTION NAME = INSERTEMAIL
> >email address gets passed in as an argument. FIRST I want to call the
> >CHECKEMAIL method, then use the value that is returned to either (a)
> >insert the record into the database, or (b) not insert the record into
> >the database.
> >CFRETURN SOME SORT OF MESSAGE
> >/CFFUNCTION
> >/CFCOMPONENT
> >
> >What is the best way to do this?
> >
> >Thanks,
> >
> >Pete
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216075
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54