>- see footer for list info -<
Hi Stephen

Cheers for that, its interesting?

Whats you wonder why they designed isdefined() to act like it does with
variable scopes..

Regards
Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen Moretti
(cfmaster)
Sent: 25 November 2004 11:07
To: Coldfusion Development
Subject: Re: [CF-Dev] isDefined vs structkeyExists was:Best way to check i f
a form field is empty)


>- see footer for list info -<
Mark Smyth wrote:

>>- see footer for list info -<
>>    
>>
>Cheers Kola!
>
>Very interesting
>
>Regards
>
>Mark
>  
>
Sorry I didn't respond to you yesterday - hadn't noticed until late last 
night that my cfmaster account was frozen by an empty email again [Russ!]

As Kola has told you it was a long thread that I put my 2p into at the 
time to help clarify for myself exactly what was happening between 
isDefined() and StructKeyExists().  Something that isn't mentioned in 
Sean's blog that I managed to gleen, is that all scopes are always 
defined even if there are no variables in a particular scope.  Add that 
to the fact that all scopes are now structs, you can get a much more 
direct check on a variable using StructKeyExists() than you can with 
IsDefined().

The main reason for using StructKeyExists over IsDefined() is that 
IsDefined() will always do a sweep of all scopes even if you specify the 
scope as part of the variable to check for, where as StructKeyExists() 
will only look where you tell it to look.

eg. form.myvar
StructKeyExists(form,"myvar") will only look for myvar in the form scope.
IsDefined("form.myvar") will look for form.myvar, variable.form.myvar, 
form.form.myvar and so on......

So there you go.

Stephen


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
>-<

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to