I assume you are talking about UDFs, right?

If you are writing a script based UDF, you simply exclude the optional
args from your list of args in your UDF declaration. So, if function foo
takes one required arg and one optional arg, the optional arg must be
the second arg and you check for it's existence in your code:

function foo(x) {
        var y = 0;
        if(arrayLen(arguments) gte 2) y = arguments[2];

}

If you use the CFFUNCTION tag, it's as simple as saying REQUIRED="false"
in your <cfargument> tag.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc

Email    : [EMAIL PROTECTED]
WWW      : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Robert Everland [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, February 03, 2003 1:05 PM
> To: CF-Talk
> Subject: Function parameter question
> 
> 
> Can I make certain parameters optional? If so how?
> 
> Robert Everland III
> Web Developer Extraordinaire
> Dixon Ticonderoga Company
> http://www.dixonusa.com 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to