phylum1234
Programmer
I'm trying to pass dynamically generated form names and their values to an update query. I've tried to pass the form name query which gives me the form names in the first
place, but then I have to somehow piece together "form." and the dynamically generated name, which in this case is a unique ID from the database to the update query fields
form page:
<cfform action="updateRateAction.cfm" method="post" name="yearView">
<cfoutput query="getRates">
<tr>
<td><A HREF="deleteRate.cfm?rate=#getRates.ID#&comp=#comp#&year=#year#">d</A> / <A HREF="updateRate.cfm?rate=#getRates.ID#&comp=#comp#&year=#year#">u</A>
</td>
<td>#cat_num#</A></td>
<td width="325"><span class="11"><strong>#labor_cat#</A> </strong></span></td>
<td><cfinput name="#getRates.ID#" type="text" value="#DollarFormat(baseOffSite)#" size="6" maxlength="6"></td>
<td><cfinput name="#getRates.ID#" type="text" value="#DollarFormat(baseOnSite)#" size="6" maxlength="6"></td></tr>
more...
update action page:
<cfloop index="i" from="1" to="#ArrayLen(session.rateOffSiteArray)#" step="1">
<cfquery name="updateRates" datasource="rates" dbtype="ODBC">
update laborRates set
baseOffSite = #form. (...this where I'm having trouble...)#
where ID = #session.rateOnSiteArray#
</cfquery>
</cfloop>
</cfoutput>
place, but then I have to somehow piece together "form." and the dynamically generated name, which in this case is a unique ID from the database to the update query fields
form page:
<cfform action="updateRateAction.cfm" method="post" name="yearView">
<cfoutput query="getRates">
<tr>
<td><A HREF="deleteRate.cfm?rate=#getRates.ID#&comp=#comp#&year=#year#">d</A> / <A HREF="updateRate.cfm?rate=#getRates.ID#&comp=#comp#&year=#year#">u</A>
</td>
<td>#cat_num#</A></td>
<td width="325"><span class="11"><strong>#labor_cat#</A> </strong></span></td>
<td><cfinput name="#getRates.ID#" type="text" value="#DollarFormat(baseOffSite)#" size="6" maxlength="6"></td>
<td><cfinput name="#getRates.ID#" type="text" value="#DollarFormat(baseOnSite)#" size="6" maxlength="6"></td></tr>
more...
update action page:
<cfloop index="i" from="1" to="#ArrayLen(session.rateOffSiteArray)#" step="1">
<cfquery name="updateRates" datasource="rates" dbtype="ODBC">
update laborRates set
baseOffSite = #form. (...this where I'm having trouble...)#
where ID = #session.rateOnSiteArray#
</cfquery>
</cfloop>
</cfoutput>