I am trying to create an array of structs from values passed from a form. 
Using this code, the resulting array has the same value in each array cell 
from last iteration of the loop. The desired result, of course, is toi hae 
each pair of form values passed to a struct in each array cell. As far as I 
can tell, it seems the earsh array cell is only a reference to the fileInfo 
struct which gets rewritten each loop. I can't recall where I have read 
about assigning vallues and referencing variables in CFML to help me 
clarify wht is going on and how to get it working as I want. (If you are 
wondering, the form is from Plupload for uploading files.

I want ot put the valuesinto an array because I will be doing a bunch of 
operations to or on the files and looping over and array each time will be 
simplier can repeatedly dealing with the dynamically generated form 
variables. Any help getting on track and beter understanding what is 
goingon here is much appeciated.

Magnus


<cfdump var="#FORM#"> ...the starting values...
structFIELDNAMES
UPLOADER_0_NAME,UPLOADER_0_STATUS,UPLOADER_1_NAME,UPLOADER_1_STATUS,UPLOADER_2_NAME,UPLOADER_2_STATUS,UPLOADER_3_NAME,UPLOADER_3_STATUS,UPLOADER_4_NAME,UPLOADER_4_STATUS,UPLOADER_COUNT
UPLOADER_0_NAMEANGELS.wavUPLOADER_0_STATUS 
doneUPLOADER_1_NAMEKalimba.mp3UPLOADER_1_STATUS 

doneUPLOADER_2_NAMEMachine_Gun_Alley_1.oggUPLOADER_2_STATUS 
doneUPLOADER_3_NAMEMaid with the Flaxen Hair.mp3UPLOADER_3_STATUS done
UPLOADER_4_NAMESleep Away.mp3UPLOADER_4_STATUS  
doneUPLOADER_COUNT5
Here is the code..
<cfset fileArray = arrayNew(1)>
<cfloop index="i" from="0" to="#FORM.uploader_count-1#" step="1">
    <cfset fileInfo.name=#Evaluate("FORM.uploader_" & i & "_name")#>
    <cfset fileInfo.status=#Evaluate("FORM.uploader_" & i & "_status")#>
    <cfset fileArray[i+1] = fileInfo>
    <cfdump var="#fileInfo#"
    
</cfloop>

<cfdump var="#fileArray#"> ...the end result...
array1   
structnameSleep Away.mp3status done

2structnameSleep Away.mp3status 
done

3structnameSleep Away.mp3status done

4structnameSleep Away.mp3status done

5structnameSleep Away.mp3status done

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to