If they're sequential then this'll help:
<cfset i = 0>
<cfloop condition="IsDefined('FORM.linkText_#i#')">
#FORM["linkText_" & i]#
<br />
#FORM["linkURL_" & i]#
<cfset i = i + 1>
</cfloop>
Adrian
Building a database of ColdFusion errors at http://cferror.org/
-----Original Message-----
From: Tom King
Sent: 29 October 2008 13:37
To: cf-talk
Subject: Looping over form structs into an array or query
Hi All,
I've got a form where I've got a potentially unknown number of form fields
as they're being added by Javascript;
i.e
form.linkText_1
form.linkUrl_1
form.linkText_2
form.linkUrl_2
form.linkText_3
form.linkUrl_3
form.linkText_4
form.linkUrl_4
How can I deal with this at the other end?
I can output them (but in no useful order):
<cfloop list="#structKeyList(form)#" index="key">
<cfoutput>
<cfif len(form[key]) GTE 1 AND key CONTAINS "link">
<p>Key: #key#, Value: #form[key]#</p>
</cfif>
</cfoutput>
</cfloop>
How would I get these into an Array or a Query object where they are paired
up by number?
Thanks
T
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314528
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4