And no sooner do I mention typos! label should be fileName and value should be titleName in the function.
Right, I'm really going to bed now... Zzzzzzzzzzzz Zzzzzzzzzzzzzzzz Zzzzzzzzzzzzzzzzzz Ade :OD -----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: 14 January 2005 02:10 To: CF-Talk Subject: RE: Joe - dave > Arrays VS. Structures? Just done something like this but for associating form labels with values. Seems like it's what you're after... <cffunction name="FilesNTitles" returntype="array" output="no"> <cfargument name="yourArray" required="yes" type="array"> <cfargument name="fileName" required="yes" type="string"> <cfargument name="titleName" required="yes" type="string"> <cfset yourArray[ArrayLen(ARGUMENTS.yourArray) + 1] = StructNew()> <cfset yourArray[ArrayLen(ARGUMENTS.yourArray)].label = ARGUMENTS.label> <cfset yourArray[ArrayLen(ARGUMENTS.yourArray)].value = ARGUMENTS.value> <cfreturn labelsNValues> </cffunction> ...and you'd use it like this... <!--- The form action page ---> <cfset someVar = ArrayNew(1)> <cfloop from="1" to="#VARIABLES.numberOfFields#" index="i"> <cfset someVar= FilesNTitles(someVar, FORM["fileName" & i], FORM["titleName" & i])> </cfif> <!--- Have a look at what we have, it should be an array of structures ---> <cfdump var="someVar"> ... and then you can get at the values like this... <cfoutput> <cfloop from="1" to="#ArrayLen(someVar)#" index="i"> #someVar[i].fileName# - #someVar[i].titleName# - </cfif> <cfoutput> ... is that any good? Untested so watch out for typos/mistakes. It's gone two in the morning here, I'm away to bed, I'm kerknackered :OS Ade -----Original Message----- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: 14 January 2005 00:07 To: CF-Talk Subject: Joe - dave > Arrays VS. Structures? I'm starting this thread to continue a discussion on file uploads, arrays, etc.. I'm reading some on Jeff Peters book, Lists, arrays, and structures, and I'd like to ask you guys what would be the best way to handle my form values, looping them into a table. Let's say I had this for a form. <cfset numberoffields = 5> <cfloop index="i" from="1" to="#variables.numberoffields#" step="1"> <cfset filename = "file" & i> <cfset titlename = "title" & i> <input type="File" name="<cfoutput>#variables.filename#</cfoutput>" /> <input type="text" name="<cfoutput>#variables.titlename#</cfoutput>" /> <br /> </cfloop> How would I build a flexible array or structure that ArrayAppend(ed) or StructAppend(ed) my items into them. Then I loop over the array or structure and insert the values into my table. What's the best method? Joe? dave? Could you provide a simple example? Thanks, Will -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12/01/2005 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190365 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

