Yes...

StructKeyExists is better in most cases. 

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 29, 2008 11:13 AM
To: CF-Talk
Subject: RE: Why is CF giving me grief over this code?

Thanks, everyone, for clearing that up.

On a side note... is it better to use

'structKeyExists(url, 'property_type')'

as opposed to

'isdefined('url.property_type')'

???

And, if so, why?

Thanks,

Rick

> -----Original Message-----
> From: Charlie Griefer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 29, 2008 12:03 PM
> To: CF-Talk
> Subject: Re: Why is CF giving me grief over this code?
> 
> On Thu, May 29, 2008 at 8:57 AM, Rick Faircloth 
> <[EMAIL PROTECTED]> wrote:
> > ?
> >
> > <cfif isdefined('url.property_type')>
> >   <cfswitch expression='#url.property_type#'> <cfelse>
> >   <cfswitch expression='#form.property_type#'>
> > </cfif>
> >
> > It's complaining with this error:
> >
> > Context validation error for the cfelse tag.
> > The tag must be nested inside a CFIF tag.
> >
> > Can cfswitch tags not be nested inside cfif tags?
> 
> not like that, no.  you need to finish the switch inside of each
condition.
> 
> would be "better" to do:
> 
> <cfif structKeyExists(url, 'property_type')>
>      <cfset variables.property_type = URL.property_type /> </cfif> 
> <cfif structKeyExists(form, 'property_type')>
>      <cfset variables.property_type = form.property_type /> </cfif>
> 
> then
> 
> <cfswitch expression="#variables.property_type#">
>      (case statements)
> </cfswitch>
> 
> i think there's a custom tag out there that will automagically put 
> form/URL vars into an "attributes" scope.  This is how fusebox does it 
> by default (and in Model-Glue it's in the 'event')... but I seem to 
> recall a custom tag that would accomplish the same end for folks who 
> aren't using a framework.
> 
> 
> --
> A byte walks into a bar and orders a pint. Bartender asks him "What's 
> wrong?" Byte says "Parity error." Bartender nods and says "Yeah, I 
> thought you looked a bit off."
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306271
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to