I am looping over a collection (form) and testing for ‘attachedFile’ in the form field name. On success, I want to add the form field value to an array. Currently, I am only getting the form field name and not the value.
<cfloop collection="#FORM#" item="field">
<cfif FindNoCase('attachedFile',field) IS 1>
<cfset fileNamesArray[fileNamesIndex] = field>
<cfset fileNamesIndex = fileNamesIndex + 1>
</cfif>
</cfloop>
I tried setting the array at index [whatever] to #form.field# but that results in an error (undefined). Any ideas how to get my value inside this loop? Thanks.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fe2.html
Or if you prefer the script style, and you’re using CF9, use the for-in loop