Re: This evaluate thing always stumps me...
On a more "personal style" note, I generally do a cfparam on all my form variables and then loop over the form structure and trim() all the values. I then do not have to check for existence or trim when checking length. On Jan 21, 2008 2:32 PM, Charlie Griefer <[EMAIL PROTECTED]> wrote: > On Jan 21, 2008 11:18 AM, Sonny Savage <[EMAIL PROTECTED]> wrote: > > You really should use this: > > Len(form["grp_sort_" > > & myIDX]) GT 0 )> > > if you're going to validate against the len(), you really should throw > a trim() in there for good measure :) > > > -- > "Scientists tell us that the fastest animal on earth, with a top speed > of 120 feet per second, is a cow that has been dropped out of a > helicopter." - Dave Barry > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297019 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: This evaluate thing always stumps me...
Again, these really should be using StructKeyExists: On Jan 21, 2008 1:48 PM, Les Mizzell <[EMAIL PROTECTED]> wrote: > This one works: > >AND Form['grp_sort_#myIDX#'] NEQ ""> > > > Jezz, thanks... > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297018 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
On Jan 21, 2008 11:18 AM, Sonny Savage <[EMAIL PROTECTED]> wrote: > You really should use this: > & myIDX]) GT 0 )> if you're going to validate against the len(), you really should throw a trim() in there for good measure :) -- "Scientists tell us that the fastest animal on earth, with a top speed of 120 feet per second, is a cow that has been dropped out of a helicopter." - Dave Barry ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297012 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
>> -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297007 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
You really should use this: On Jan 21, 2008 1:40 PM, Les Mizzell <[EMAIL PROTECTED]> wrote: > Andy Matthews wrote: > > Get rid of the Evaluate statement. > > > > This: evaluate("form.grp_sort_#myIDX#") > > > > Becomes this: FORM["grp_sort_#myIDX#"] > > or this: FORM["grp_sort_" & myIDX] > > >AND #FORM["grp_sort_" & myIDX]# NEQ ""> > > > Invalid CFML construct found on line 115 at column 24. > ColdFusion was looking at the following text: > > grp_sort_ > > > Hmmm... > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297008 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: This evaluate thing always stumps me...
Andy Matthews wrote: > Get rid of the Evaluate statement. > > This: evaluate("form.grp_sort_#myIDX#") > > Becomes this: FORM["grp_sort_#myIDX#"] > or this: FORM["grp_sort_" & myIDX] Invalid CFML construct found on line 115 at column 24. ColdFusion was looking at the following text: grp_sort_ Hmmm... ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297001 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
This one works: Jezz, thanks... ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297003 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: This evaluate thing always stumps me...
Adding to Charlie's advice... structKeyExists() is faster than isDefined() and I have not found a case where it couldn't be used instead. It can be used on local values by checking the variables scope: structKeyExists(variables, "localVarName") On Jan 21, 2008 1:29 PM, Andy Matthews <[EMAIL PROTECTED]> wrote: > Get rid of the Evaluate statement. > > This: evaluate("form.grp_sort_#myIDX#") > > Becomes this: FORM["grp_sort_#myIDX#"] > or this: FORM["grp_sort_" & myIDX] > > > -Original Message- > From: Les Mizzell [mailto:[EMAIL PROTECTED] > Sent: Monday, January 21, 2008 12:24 PM > To: CF-Talk > Subject: This evaluate thing always stumps me... > > This evaluate thing, which doesn't work below, always stumps me.. > > > > > AND #evaluate("form.grp_sort_#myIDX#")# NEQ ""> > > > > > > > .which, for myIDX = "115", gets you "Variable form.grp_sort_115 is > undefined". > > > What's the best way to rewrite this so it works.. > > TIA > > > > > > > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297002 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: This evaluate thing always stumps me...
If you're on CF5 or previous, this will have to be 2 statements: -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: Monday, January 21, 2008 1:24 PM To: CF-Talk Subject: This evaluate thing always stumps me... This evaluate thing, which doesn't work below, always stumps me.. .which, for myIDX = "115", gets you "Variable form.grp_sort_115 is undefined". What's the best way to rewrite this so it works.. TIA ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296993 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: This evaluate thing always stumps me...
> If you're on CF5 or previous, this will have to be 2 statements: > > > I'm pretty certain that short-circuit evaluation was introduced in CF 4.0.1. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297000 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
This is a great little reference to bookmark, just in case you forget in the future. http://cfprimer.blogspot.com/2005/03/avoid-evaluate.html On Jan 21, 2008 12:29 PM, Andy Matthews <[EMAIL PROTECTED]> wrote: > Get rid of the Evaluate statement. > > This: evaluate("form.grp_sort_#myIDX#") > > Becomes this: FORM["grp_sort_#myIDX#"] > or this: FORM["grp_sort_" & myIDX] > > > -Original Message- > From: Les Mizzell [mailto:[EMAIL PROTECTED] > Sent: Monday, January 21, 2008 12:24 PM > To: CF-Talk > Subject: This evaluate thing always stumps me... > > This evaluate thing, which doesn't work below, always stumps me.. > > > > > AND #evaluate("form.grp_sort_#myIDX#")# NEQ ""> > > > > > > > .which, for myIDX = "115", gets you "Variable form.grp_sort_115 is > undefined". > > > What's the best way to rewrite this so it works.. > > TIA > > > > > > > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296997 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: This evaluate thing always stumps me...
Sorry, I meant to type this: Square brackets, not parentheses. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296999 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
Or better, use StructKeyExists to avoid any potential ambiguity: http://corfield.org/blog/index.cfm/do/blog.entry/entry/isDefined_vs_structKeyExists On Jan 21, 2008 1:28 PM, Jonathon Stierman <[EMAIL PROTECTED]> wrote: > You don't need to use Evaluate() to perform that isDefined check. > > Simply use: > > > > > If you need to get the reference to that variable, use array notation on > your Form struct: > > Form['grp_sort_#myIDX#'] > > Jonathon > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296998 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: This evaluate thing always stumps me...
form['grp_sort_' & myIDX] to make sure what you are looking for is even there. ..:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: Monday, January 21, 2008 1:24 PM To: CF-Talk Subject: This evaluate thing always stumps me... This evaluate thing, which doesn't work below, always stumps me.. .which, for myIDX = "115", gets you "Variable form.grp_sort_115 is undefined". What's the best way to rewrite this so it works.. TIA ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296994 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: This evaluate thing always stumps me...
You don't need to use Evaluate() to perform that isDefined check. Simply use: If you need to get the reference to that variable, use array notation on your Form struct: Form['grp_sort_#myIDX#'] Jonathon ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296991 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: This evaluate thing always stumps me...
That should do it, and without the need for Evaluate. -- Josh - Original Message - From: "Les Mizzell" <[EMAIL PROTECTED]> To: "CF-Talk" Sent: Monday, January 21, 2008 10:23 AM Subject: This evaluate thing always stumps me... > This evaluate thing, which doesn't work below, always stumps me.. > > > > > AND #evaluate("form.grp_sort_#myIDX#")# NEQ ""> > > > > > > > which, for myIDX = "115", gets you "Variable form.grp_sort_115 is > undefined". > > > What's the best way to rewrite this so it works.. > > TIA > > > > > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296996 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: This evaluate thing always stumps me...
also, could you elaborate on "doesn't work"? On Jan 21, 2008 10:23 AM, Les Mizzell <[EMAIL PROTECTED]> wrote: > This evaluate thing, which doesn't work below, always stumps me.. > > > > >AND #evaluate("form.grp_sort_#myIDX#")# NEQ ""> > > > > > > > which, for myIDX = "115", gets you "Variable form.grp_sort_115 is > undefined". > > > What's the best way to rewrite this so it works.. > > TIA > > > > > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296990 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: This evaluate thing always stumps me...
Get rid of the Evaluate statement. This: evaluate("form.grp_sort_#myIDX#") Becomes this: FORM["grp_sort_#myIDX#"] or this: FORM["grp_sort_" & myIDX] -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: Monday, January 21, 2008 12:24 PM To: CF-Talk Subject: This evaluate thing always stumps me... This evaluate thing, which doesn't work below, always stumps me.. .which, for myIDX = "115", gets you "Variable form.grp_sort_115 is undefined". What's the best way to rewrite this so it works.. TIA ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296992 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: This evaluate thing always stumps me...
>AND #evaluate("form.grp_sort_#myIDX#")# NEQ ""> Since CF 4, you don't really need to do this much work. And beside that, IsDefined automatically evaluates its argument. Here's all you need: Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296995 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4