Best way might be to simply pass in the entire FORM scope, then loop over it like so:
collection="#arguments.fieldnames#" -----Original Message----- From: Rick Faircloth [mailto:[email protected]] Sent: Monday, December 29, 2008 3:58 PM To: cf-talk Subject: How to loop through formfields in a component? I have this code that I've kept in my .cfm file to process images. The form has an image field that can be cloned via jQuery, so I don't know before a form is submitted how many fildfields it will have. Therefore, I have to loop through the fieldnames and process the fields named a certain way to specify images to be processed. I kept this code in the form's .cfm file, because I wasn't sure what to "loop"...in this code I loop through the form with collection="#form#". Would I loop through collection="#arguments#" once the form variables are passed to the component via argumentCollection? Or am I better off keeping this code in the .cfm? Thanks, Rick Here's the code: <cfloop collection="#form#" item="fieldname"> <cfset form.rental_photo_original=""> <cfset form.rental_photo_w200=""> <cfset form.rental_photo_w500=""> <cfif left("#fieldname#", 5) eq "image"> <cffile action="upload" filefield="#fieldname#" destination="e:\inetpub\webroot\fortstewart\user_images" accept="image/jpg, image/pjpg, image/jpeg, image/pjpeg" nameconflict="makeunique"> etc... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:317243 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

