I believe that IsDefined is only meant to check for the existance of top
level variables, for complex data types you have to use the specific
functions for each type. So here CF is trying to find out if there is a
variable named "aStruct[aField]" and brackets are illegal in cf variable
names.

In this case I think you'll have to do a 3 step process:

<cfif IsDefined("aStruct") And IsStruct(aStruct) And StuctKeyExists(aStruct,
"aField")>
..
</cfif>


</rob>

-----Original Message-----
From: cf refactoring [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 11:50 AM
To: CF-Talk
Subject: IsDefined and brackets


The following code throws a syntax error:

<cfset aStruct=StructNew()>
<cfset aStruct.aField="something">
<cfif IsDefined("aStruct[aField]")>
        aStruct[aField] is defined
</cfif>

Is this just some CF quirk that IsDefined doesn't like
brackets or is there some good reason for this?

=====
I-Lin Kuo
Macromedia CF5 Advanced Developer
Sun Certified Java 2 Programmer

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to