Re: CFLOOP issues

2002-11-22 Thread Jochem van Dieten
Cutter (CF_Talk) wrote:

 cfloop index=i from=1 to=4
 cfset variables.imagefield = evaluate(form.strImage#i#New)

 cfif isdefined(form.strImage#i#New)
 cfif len(variables.imagefield)
 *
 *  More processing stuff here
 *
 cfset variables.image#i# = photo
 cfset variables.thumb#i# = thumb

 cfif len(form.strImage#i#)
 *
 *  Even more processing stuff
 *
 /cfif
 /cfif
 /cfif
 cfloop

 What am I doing wrong?

I have no idea, because I don't know what the code is supposed to do. 
But I think using the syntax below will make it easier to see what is 
going on (and watch the extra quotes in the cfset statement):

cfloop index=i from=1 to=4
 cfif isdefined(form.strImage#i#New)
 cfif len(form[strImage#i#New])
 *
 *  More processing stuff here
 *
 cfset variables.image#i# = photo
 cfset variables.thumb#i# = thumb

 cfif len(form[strImage#i#])
 *
 *  Even more processing stuff
 *
 /cfif
 /cfif
 /cfif
cfloop

Jochem

~|
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: CFLOOP issues

2002-11-22 Thread Bryan Love
The most obvious thing is that the cfset... should be inside the cfif...

you should also use form[strImage#i#New] instead of evaluate.

+---+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

...'If there must be trouble, let it be in my day, that my child may have
peace'...
- Thomas Paine, The American Crisis

Let's Roll
- Todd Beamer, Flight 93



-Original Message-
From: Cutter (CF_Talk) [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 11:51 AM
To: CF-Talk
Subject: CFLOOP issues


*** Sorry if this is repost, still having mail server/client issues ***
Something new for me within CF so any help is greatly appreciated. I'm 
trying to loop through a number of form fields (form.strImage1, 
form.strImage2, form.strImage3, form.strImage4), do some checking, set 
some variables. But what I'm doing (and I've never done) must be off 
base. Here's an example:

cfloop index=i from=1 to=4
cfset variables.imagefield = evaluate(form.strImage#i#New)

cfif isdefined(form.strImage#i#New)
cfif len(variables.imagefield)
*
*  More processing stuff here
*
cfset variables.image#i# = photo
cfset variables.thumb#i# = thumb

cfif len(form.strImage#i#)
*
*  Even more processing stuff
*
/cfif
/cfif
/cfif
cfloop

What am I doing wrong?

Cutter


~|
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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.