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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Form Fields Based on Arrays 1

Status
Not open for further replies.

MinalMoe

IS-IT--Management
Mar 25, 2004
62
GB
I'm using MX7 and need to build up a variable number of fields in a form. Creating the variable list of fields to match number of items in list creates no problem -

<cfloop index = "yy" from = "1" to = #List_No#>
<cfinput type="text" name="DOB" id="DOB"/><br />
</cfloop>

That's fine. The problem is changing the name or ID of the field from DOB1 to DOB2 etc, and how does the the next page detect #Form.DOB1# and #Form.DOB2# etc.

Thanks
 
<cfloop index = "yy" from = "1" to = #List_No#>
<cfinput type="text" name="DOB#yy#" id="DOB#yy#" /><br />
</cfloop>
<input type="hidden" value="#yy#" name="fieldCount" />



action page

<cfloop from="1" to="#form.fieldCount#" index="yy">
FORM.DOB#yy# = #FORM["DOB" & yy]#<br/>
</cfloop>


Kevin

Phase 1: Read the CFML Reference
Phase 2: ???
Phase 3: Profit!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top