Copy link to clipboard
Copied
This appears in my dump var:
struct
ACTIONupdateRecordsListings
FIELDNAMESITEMORDER[],ACTION
ITEMORDER[]558,559,536,478,469,468,466,465,464,397,191,11,175
I cannot get it to work to loop over the itemorders and output them. I know it's simple but cannot get it to work.
Here's my code:
<cfloop index="i" from="1" to="#ArrayLen(form)#">
<cfoutput>
#form.itemorder#
</cfoutput>
</cfloop>
Thank you very much in forward.
Copy link to clipboard
Copied
#ArrayLen(form)#">
FORM is a structure, not an array.
#form.itemorder#
Adding square brackets to multiple form field names does not create an array. It just creates a single field literally named "ITEMORDER[]". The value of the field is a comma separated string. To access the value you need to use associative array notation (due to the special characters in the field name ie "[]").
<cfset theCSVList = FORM["itemorder[]"]>
Once you have the value you can cfloop through it as a "list". You could also convert it to an array explicitly and use <cfloop array="...">
Copy link to clipboard
Copied
Thanx Search for this insight.
Copy link to clipboard
Copied
If itemorder is an array, then this should work:
<cfloop index="i" from="1" to="#ArrayLen(itemorder)#">
<cfoutput>
#itemorder#<br>
</cfoutput>
</cfloop>