I agree with NK pay attention to the evaluate function. It works like a charm for dynamically created form variables. I use it often. :) -- Ryan LeTulle
On Tue, Jun 9, 2009 at 6:30 PM, N K <[email protected]> wrote: > > Check the following link might help... > http://tutorial431.easycfm.com/ > > > > Hello all, > > > I have a dynamically generated form that I need to figure out how to > > get the data from that form in to our database. Here is the way it > > works. First the client types in the number of machines they have and > > the form generates the correct number of rows so that the info about > > each machine is located on a separate row. That all works well until > > they hit submit (or will hit submit if I figure out the next part). > > How do I create a cfquery that has the correct number of values so > > that each machines data is stored correctly? > > > > For example I will have row one with lets say three fields (Type, > > number, issue). Lets say a client has a problem with 10 machines. > > The form now has 10 rows with 3 columns in each. Each field in row > > one is named type1, number1, issue1 and row two is type2, number2, > > issue2, etc.. The number next to the name is placed there by putting > > the index of the loop in the name field. So this is where I was going > > to use a CFLOOP inside a CFquery to create field names dynamically. I > > can get it to repeate the information correctly, however the problem > > is the index of the loop does not seem to get attached to the form > > value I am putting into the database. > > > > I am doing something like: > > > > <cfquery datasource="#request.datasource#"> > > INSERT into tbl_ballotOrder (type, number, issue) > > Values ( > > <cfloop from="1" to="#rows#" step="1" index="LoopCount"> > > > > '#FORM.type##LoopCount#', '#FORM.number##LoopCount#', '#FORM. > > issue##LoopCount#' > > > > </cfloop> > > ) > > </cfquery> > > </cfif> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323301 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

