RE: isDefined() finesse

2002-11-26 Thread Sam Roach
Because the isdefined function doesn't care what the value of the variable
you are passing you don't need to use the evaluate function.  

However if you wanted to output that value you would have to use something
like:

cfoutput#Evaluate(form.serNum#i#)#/cfoutput

-Original Message-
From: j cc [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 9:12 AM
To: CF-Talk
Subject: isDefined() finesse


   cfif isDefined(Form.SerNum#i#)

at first I thought it would be isDefined(evaluate(form.serNum#i#))

BUT

what you had worked fine when i put it in CF 5.

for a test I did this...

form name=foo action=test.cfm method=post
input type=hidden name=serNum1 value=foo
input type=submit value=go
/form
cfset i =1
cfif isDefined(form.serNum#i#)
  foo!
/cfif

and after submitting the form, I received foo! as my output.

-jc

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



RE: -isDefined() finesse

2002-11-25 Thread Raymond Camden
So what is wrong? Your code looks fine to me.

===
Raymond Camden, ColdFusion Jedi Master for Hire

Email: [EMAIL PROTECTED]
WWW  : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Brian Scandale [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, November 25, 2002 3:11 PM
 To: CF-Talk
 Subject: -isDefined() finesse
 
 
 I am trying to see if a particular dynamic variable is 
 defined... but having trouble building the ifDefined argument.
 
 Form.SerNum1
 Form.SerNum2
 Form.SerNum3 ...etc. are built dynamically and then passed to 
 an action form below like below.
 
 -cfloop index=i from=1 to=#theSerNums.RecordCount#
   -cfif isDefined(Form.SerNum#i#)
   DoSomething
   -cfelse
   DoSomethingElse
   -/cfif
 -/cfloop 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



Re: -isDefined() finesse

2002-11-25 Thread Brian Scandale
Sorry, just worked it out...

-cfif isDefined(Form.SerNum#i#)


At 01:11 PM 11/25/02, you wrote:
I am trying to see if a particular dynamic variable is defined... but having trouble 
building the ifDefined argument.

Form.SerNum1
Form.SerNum2
Form.SerNum3 ...etc. are built dynamically and then passed to an action form below 
like below.

-cfloop index=i from=1 to=#theSerNums.RecordCount#
-cfif isDefined(Form.SerNum#i#)
DoSomething
-cfelse
DoSomethingElse
-/cfif
-/cfloop 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com



RE: -isDefined() finesse

2002-11-25 Thread Raymond Camden
Well your original code should have worked as well. Also note you could
do:

isDefined(form.sernum  i)

as well as structKeyExists(form,sernum#i#)

===
Raymond Camden, ColdFusion Jedi Master for Hire

Email: [EMAIL PROTECTED]
WWW  : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Brian Scandale [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, November 25, 2002 3:18 PM
 To: CF-Talk
 Subject: Re: -isDefined() finesse
 
 
 Sorry, just worked it out...
 
 -cfif isDefined(Form.SerNum#i#)
 
 
 At 01:11 PM 11/25/02, you wrote:
 I am trying to see if a particular dynamic variable is 
 defined... but having trouble building the ifDefined argument.
 
 Form.SerNum1
 Form.SerNum2
 Form.SerNum3 ...etc. are built dynamically and then passed 
 to an action form below like below.
 
 -cfloop index=i from=1 to=#theSerNums.RecordCount#
 -cfif isDefined(Form.SerNum#i#)
 DoSomething
 -cfelse
 DoSomethingElse
 -/cfif
 -/cfloop 
 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



RE: -isDefined() finesse

2002-11-25 Thread Mark Johnson
Another Option:

-cfloop index=i from=1 to=#theSerNums.RecordCount#
-cfif structKeyExists(Form,'SerNum'  i)
DoSomething
-cfelse
DoSomethingElse
-/cfif
-/cfloop

however what you have looks fine to me.

Mark

-Original Message-
From: Brian Scandale [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 25, 2002 1:11 PM
To: CF-Talk
Subject: -isDefined() finesse


I am trying to see if a particular dynamic variable is defined... but having
trouble building the ifDefined argument.

Form.SerNum1
Form.SerNum2
Form.SerNum3 ...etc. are built dynamically and then passed to an action form
below like below.

-cfloop index=i from=1 to=#theSerNums.RecordCount#
-cfif isDefined(Form.SerNum#i#)
DoSomething
-cfelse
DoSomethingElse
-/cfif
-/cfloop


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm