I want to take a set of sequentially numbered form field names (typeid_1,
typeid_2, typeid_3, typedetails_1, typedetails_2, typedetails_3, and so on)
and loop through them to create a query object. I could do this the hard way
(i.e. 7 nearly identical blocks of code), but I would prefer to do this the
right way, but for the life of me I can't remember the proper syntax for
using the index values in variable names. Here's the code I have now (that
doesn't work):
<cfscript>
qryDetails = queryNew("dataCardID,typeid,details,display_order");
for (i = 1; i LTE 7; i = i + 1) {
if (NOT isNullNumeric(FORM.typeid_[i])) {
queryAddRow(qryDetails);
querySetCell(qryDetails,"dataCardID",insertDataCard.dataCardID);
querySetCell(qryDetails,"typeid",FORM.typeid_[i]);
querySetCell(qryDetails,"details",trim(FORM.typedetails_[i]));
querySetCell(qryDetails,"display_order",i);
}
}
</cfscript>
What am I doing wrong?
Thanks
Pete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212683
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54