A few ways, pass the record count along in a hidden field then loop:

<cfloop from="1" to="#FORM.recordCount#" index="i">
        <cfoutput>#FORM["anID" & i]#</cfoutput>
</cfloop>

Or requery on the next page and work out the record count there.

Or do a conditional loop with an IsDefined("FORM.anID#i#") and a counter to
increment i.

A short limerick for you: "There once was man name Richard Cooper, who got
WHOOPED on Street Fighter 2"

I didn't say it was a good limerick! :O.

-----Original Message-----
From: Richard Cooper [mailto:[EMAIL PROTECTED]
Sent: 15 July 2008 12:14
To: CF-Talk
Subject: Loop over field names


Hi All,

Having brain freeze on this... Basically have a form, part of the form is
populated from a query within an unknown number of field elements.

The form code snippet would look something like this.

<cfoutput query="someQuery">
  <input name="anID#currentRow#" value="#anID#" />
  <input name="someField#currentRow#" value="#someFieldValue#" />
  <input name="otherField#currentRow#" value="#otherFieldValue#" />
</cfoutput>

I want to be able to take the form and run either update or creates for the
form. How would I go about referencing the form fields to insert/update my
DB?

Thanks,

R


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

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

Reply via email to