It sounds like you might want to use an array for this rather than a struct.

A struct is better if you are dealing with different properties of a single
thing.  What you have is multiple instances of the same thing, i.e. photo
names.

If you do want to use a structure, you can use the "collection" and "item"
attributes of the cfloop tag:
<cfloop collection="#session.values.client_photos_200#" item="photoname">
<!--- output stuff --->
</cfloop>

-- Josh



-----Original Message-----
From: Rick Faircloth [mailto:[email protected]] 
Sent: Wednesday, March 11, 2009 4:11 PM
To: cf-talk
Subject: Ok...not getting it...how can I loop over a session struct? Or
should I even try?


Am I trying to do the impossible?

Let's say I want to have this:

<cfset session.values.client_photos_200 = structNew()>

and the data I have is:

<cfset session.values.client_photos_200 =
structAppend(session.values.client_photos_200, "red.jpg") />
<cfset session.values.client_photos_200 =
structAppend(session.values.client_photos_200, "blue.jpg") />

Now I've got two pieces of a data in my struct.

How can I loop over this struct and output the data?

Or should I take a different approach to storing data and looping over it?

The idea is to form a structure of some sort to handle an indefinite number
of file form fields
and output that data for display and for insertion into a db.

Thanks for any insight...

Rick 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:320415
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to