Another way, not always appropriate but depending on your logic, you can
give the argument a default in the CFC.  That way if the variable isn't
passed to the CFC, it wont cause an error.   Mind you, if you use it in the
wrong place you wont throw an error, you'll have wrong values in your
function, so be careful where you use it.

<cffunction name="thisfunction" >

<cfargument name="foo" default="thisvalue">

. stuff .

</cffunction>

Cheers

Mike Kear

Windsor, NSW, Australia

AFP Webworks

http://afpwebworks.com



  _____  

From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Friday, 23 July 2004 9:43 AM
To: CF-Talk
Subject: RE: checking if variables are defined within <invoke>

> Is there a way to check if variables exist within a <cfinvoke>?
> <cfif isdefined("foo")>GOO = "#foo#"</cfif> doesnt work
>  
> Do you have to write a whole separate <cfinvoke>?

You could use the Iif function, I guess, but you could also just check for
the variable's existence before your CFINVOKE tag.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to