Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form with Multiple Input Fields named the same. Please Help

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
I have a form that will be utilized to input multiple records at the same time. As I could not have the input form fields named the same, I created a counter and appended the counter value each time after going thru the cfquery loop to the end of the field name.

As so:

<cfset icount=0>
<cfloop query=&quot;qry_ins_apft_rslts&quot;>


<TD class=ssiTINYTEXT>#qry_ins_apft_rslts.CO##qry_ins_apft_rslts.REGT#</TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_dt#iCount#&quot; value=&quot;#dateFormat(form.txt_tst_dt)#&quot; size=&quot;7&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_pushup_raw#iCount#&quot; value=&quot;0&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_situp_raw#iCount#&quot; value=&quot;0&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_run_raw#iCount#&quot; value=&quot;00:00&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_rmks#iCount#&quot;></TD>
<TD><input type=&quot;hidden&quot; name=&quot;test_cd&quot; value=&quot;#varTest#&quot;></TD>
<TD><input type=&quot;hidden&quot; name=&quot;count&quot; value=&quot;#qry_ins_apft_rslts.recordcount#&quot;></TD>


</TR>
<cfset icount = #icount# + 1>

</cfloop>

Problem is:

How do I decipher the form fields on the forms processing page? I do not understand how the forms collection is indexed.

It's just a bunch of testing at the moment, but here's what I'm trying: CAN YOU PLEASE HELP ME ITERATE THRU THE FORMS COLLECTION TO RETRIEVE MY SUBMITTED FORM VALUES!!!

<CFSET myarray = arrayNew(1)>

<cfloop collection=&quot;#Form#&quot; Item=&quot;VarName&quot;>
<cfoutput>
<CFSET temp= arrayAppend(myarray, &quot;#Form[VarName]#&quot;)>
</cfoutput>
</cfloop>

<CFSET myList=arrayToList(myarray, &quot;,&quot;)>
<CFSET myarray = ListToArray(myList)>

<CFLOOP INDEX=&quot;Element&quot; FROM=&quot;1&quot; TO=&quot;#ArrayLen(myarray)#&quot;>
<CFOUTPUT> Element #Element#: #myarray[Element]#<BR></CFOUTPUT>
</CFLOOP>

 
<cfset icount=0>
<cfloop query=&quot;qry_ins_apft_rslts&quot;>
<TD class=ssiTINYTEXT>#qry_ins_apft_rslts.CO##qry_ins_apft_rslts.REGT#</TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_dt#iCount#&quot; value=&quot;#dateFormat(form.txt_tst_dt)#&quot; size=&quot;7&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_pushup_raw#iCount#&quot; value=&quot;0&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_situp_raw#iCount#&quot; value=&quot;0&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_run_raw#iCount#&quot; value=&quot;00:00&quot; size=&quot;5&quot;></TD>
<TD class=ssiTINYTEXT><cfinput type=&quot;Text&quot; name=&quot;txt_rmks#iCount#&quot;></TD>
<TD><input type=&quot;hidden&quot; name=&quot;test_cd&quot; value=&quot;#varTest#&quot;></TD>
<TD><input type=&quot;hidden&quot; name=&quot;count&quot; value=&quot;#iCount#&quot;></TD>
</TR>
</cfloop>

<CFOUTPUT><CFLOOP from=&quot;1&quot; to=&quot;#form.count#&quot; index=&quot;cfield&quot;>
Textfield 1 Value #cField#:
#evaluate(&quot;#txt_situp_raw##cfield#&quot;)#<BR>
Textfield 2 Value #cField#:
#evaluate(&quot;#txt_pushup_raw##cfield#&quot;)#<BR>
Textfield 3 Value #cField#:
#evaluate(&quot;#txt_run_raw##cfield#&quot;)#<BR>
Textfield 4 Value #cField#:
#evaluate(&quot;#txt_rmks##cfield#&quot;)#<BR><BR></CFLOOP></CFOUTPUT>

should work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top