House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Why is ColdFusion giving me grief over this code?

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Why is CF giving me grief over this code?

Oh yeh, missed that one ;) Dominic Watson 05/29/2008 02:52 PM
On Thu, May 29, 2008 at 11:03 AM, Dominic Watson Charlie Griefer 05/29/2008 02:16 PM
> i think there's a custom tag out there that will automagically put Dominic Watson 05/29/2008 02:05 PM
Yes... Andy Matthews 05/29/2008 12:51 PM
On Thu, May 29, 2008 at 9:13 AM, Rick Faircloth Charlie Griefer 05/29/2008 12:38 PM
On a side note... is it better to use Brad Wood 05/29/2008 12:37 PM
Slaps head.... Gerald Guido 05/29/2008 12:37 PM
I did not look at the function but out of curiosity why not just use the Aaron Rouse 05/29/2008 12:35 PM
Oh yeah.... Gerald Guido 05/29/2008 12:28 PM
I have a function that does that. It is pretty old so don't make fun of Gerald Guido 05/29/2008 12:26 PM
Thanks, everyone, for clearing that up. Rick Faircloth 05/29/2008 12:15 PM
Steve Nelson had a tag formurl2attributes.cfm Loathe 05/29/2008 12:15 PM
On Thu, May 29, 2008 at 9:02 AM, Charlie Griefer Charlie Griefer 05/29/2008 12:10 PM
Rick Faircloth wrote: Ian Skinner 05/29/2008 12:06 PM
On Thu, May 29, 2008 at 8:57 AM, Rick Faircloth Charlie Griefer 05/29/2008 12:04 PM
you have to close the CFSWITCH tag Barney Boisvert 05/29/2008 12:02 PM
You need to have a closing cfswitch containing cfcases for it to work. Loathe 05/29/2008 12:02 PM
? Rick Faircloth 05/29/2008 11:59 AM

05/29/2008 02:52 PM
Author: Dominic Watson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306286 Oh yeh, missed that one ;) ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 02:16 PM
Author: Charlie Griefer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306278 On Thu, May 29, 2008 at 11:03 AM, Dominic Watson <watson.dominic@googlemail.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- ya, aaron mentioned that earlier in the thread.  very nice.  i never even thought about that route :\ -- 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."
05/29/2008 02:05 PM
Author: Dominic Watson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306276 > i think there's a custom tag out there that will automagically put form/URL vars into an "attributes" scope. Can be done natively in CF with two lines of code: request.args = url; StructAppend(request.args, form); Et voila Dominic -- Blog it up: http://fusion.dominicwatson.co.uk
05/29/2008 12:51 PM
Author: Andy Matthews Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306271 Yes... StructKeyExists is better in most cases. 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 ----- Excess quoted text cut - see Original Post for more ----- condition. ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:38 PM
Author: Charlie Griefer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306268 On Thu, May 29, 2008 at 9:13 AM, Rick Faircloth <Rick@whitestonemedia.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- http://corfield.org/blog/index.cfm/do/blog.entry/entry/isDefined_vs_structKeyExists -- 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."
05/29/2008 12:37 PM
Author: Brad Wood Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306266 On a side note... is it better to use 'structKeyExists(url, 'property_type')' as opposed to 'isdefined('url.property_type')' =========================================== The answer is a resounding "depends".  It depends on: 1) Version of Coldfusion 2) Whether or not the variable exists. 3) How many variables are in the url scope. My main beef with isdefined is that it scope hunts and if the variable is not defined it may take longer to return false.  Structkeyexists is a bit more verbose about what you are looking for.  The fact of the matter is you are talking a difference of milliseconds.  I have measured a difference before, but I had to loop thousands of times for it to add up and that isn't a very reliable test to compare a production app against. Here's the general consensus on this kind of stuff:  Code what is the easiest to read and maintain.  If you have a performance problem with the code, address it at that time. ~Brad
05/29/2008 12:37 PM
Author: Gerald Guido Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306267 Slaps head.... On Thu, May 29, 2008 at 12:33 PM, Aar ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:35 PM
Author: Aaron Rouse Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306264 I did not look at the function but out of curiosity why not just use the StructAppend() built into CF?  I often copy the URL scope into the Form on some of our pages due to not know if a value will be passed in by one or the other.  So I just put in a <cfset StructAppend(FORM, URL, false) /> for those needs. On Thu, May 29, 2008 at 11:24 AM, Gerald Guido <gerald.guido@gmail.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:28 PM
Author: Gerald Guido Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306263 Oh yeah.... Usage:  PopulateStruct(form,url) On Thu, May 29, 2008 at 12:24 PM, Gerald Guido <gerald.guido@gmail.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:26 PM
Author: Gerald Guido Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306262 I have a function that does that. It is pretty old so don't make fun of me..... but it works ;) http://pastebin.com/m6d287cb5 On Thu, May 29, 2008 at 12:14 PM, Loathe <timothy.heald@gmail.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:15 PM
Author: Rick Faircloth Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306260 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 ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:15 PM
Author: Loathe Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306261 Steve Nelson had a tag formurl2attributes.cfm I can't seem to find it for download though. Charlie Griefer wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:10 PM
Author: Charlie Griefer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306258 On Thu, May 29, 2008 at 9:02 AM, Charlie Griefer <charlie.griefer@gmail.com> wrote: > 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. as a followup... here's that custom tag. http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1001246 -- 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."
05/29/2008 12:06 PM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306256 Rick Faircloth wrote: > Can cfswitch tags not be nested inside cfif tags? > > Rick The whole <cfswitch...> tag can be, but not just the first half. I.E. <cfif...   <cfswittch>...</cfswitch> <cfelse>   <cfswitch>...</cfswitch> </crif> Allowed. <cfif...   <cfswittch> <cfelse>   <cfswitch> </crif> </cfswitch> Not Allowed. The quikest fix to what you are trying to do would be. <cfswitch expression(#iif(isDefined('url.property_type',de(url.property_type),de(form.property_type))#) But this is they type of solution the usually quickly gets re-factored into cleaner and simpler code.
05/29/2008 12:04 PM
Author: Charlie Griefer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306254 On Thu, May 29, 2008 at 8:57 AM, Rick Faircloth <Rick@whitestonemedia.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- 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."
05/29/2008 12:02 PM
Author: Barney Boisvert Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306251 you have to close the CFSWITCH tag On Thu, May 29, 2008 at 8:57 AM, Rick Faircloth <Rick@whitestonemedia.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 12:02 PM
Author: Loathe Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306253 You need to have a closing cfswitch containing cfcases for it to work. Rick Faircloth wrote: ----- Excess quoted text cut - see Original Post for more -----
05/29/2008 11:59 AM
Author: Rick Faircloth Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56551#306250 ? <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? Rick
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference