Answered
Form with loop variable
I have a form that has text boxes where the name is created
dynamically with a loop variable.
<cfset formcounter = 1>
<cfoutput query="ViewParts">
<input type="hidden" name="RecordID#formcounter#" value="#RecordID#">
<cfset formcounter = formcounter + 1>
</cfoutput>
<cfoutput><cfset formcountermax = #formcounter#></cfoutput>
on the page it submits to I have:
<cfloop from="1" to="#formcountermax#" index="loopcount">
<cfif form.Qtyshipped1 NEQ "0" AND form.Qtyshipped1 NEQ "">
<CFQUERY NAME="InsertQty" DATASOURCE="mydatasource">
INSERT INTO InvoiceTable
(
InvoiceID,
QtyShipped,
RecordID
)
VALUES
(
'#GetLastInvID.InvoiceID#',
#form.Qtyshipped1#,
#form.RecordID1#
)
</CFQUERY>
</cfif>
Instead of the "1" at the end of the inserted variables, I want it to be my loopcount. I just don't know how to name it so that is possible.
<cfset formcounter = 1>
<cfoutput query="ViewParts">
<input type="hidden" name="RecordID#formcounter#" value="#RecordID#">
<cfset formcounter = formcounter + 1>
</cfoutput>
<cfoutput><cfset formcountermax = #formcounter#></cfoutput>
on the page it submits to I have:
<cfloop from="1" to="#formcountermax#" index="loopcount">
<cfif form.Qtyshipped1 NEQ "0" AND form.Qtyshipped1 NEQ "">
<CFQUERY NAME="InsertQty" DATASOURCE="mydatasource">
INSERT INTO InvoiceTable
(
InvoiceID,
QtyShipped,
RecordID
)
VALUES
(
'#GetLastInvID.InvoiceID#',
#form.Qtyshipped1#,
#form.RecordID1#
)
</CFQUERY>
</cfif>
Instead of the "1" at the end of the inserted variables, I want it to be my loopcount. I just don't know how to name it so that is possible.
