> 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?
You could call it a quirk, I guess. When you use array notation, you're indicating to CF that you're not referencing a variable per se, but rather a member of a complex variable. If you use dot notation, it's clear that you're referencing a variable within a structure, I suppose, which entails checking the existence of both the structure and the member variable. You could rewrite this test to look like this: <cfif IsDefined("aStruct") and StructKeyExists(aStruct, "aField")> This clearly describes the two tests you're running. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ______________________________________________________________________ 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