I am creating variables that will be used as initial empty values for form
fields in a multi-step process. I am creating the variables as follows:
<cfscript>
variables.numPeople = 3;
variables.stPeople = structNew();
for (i=1; i LTE variables.numPeople; i=i+1) {
variables.stPeople['stPerson' & i] = structNew();
variables.stPeople['stPerson' & i]['firstName'] = "";
variables.stPeople['stPerson' & i]['lastName'] = "";
}
</cfscript>
Based on the numPeople value I want to dispaly as many sets of form fields
for a user to fill in as follows:
<cfoutput>
<form name="personForm" action="" method="post">
<cfloop index="i" from="1" to="#variables.numPeople#">
<input type="text" name="person#i#FirstName" value="" />
<input type="text" name="person#i#LastName" value="" />
</cfloop>
</form>
</cfoutput>
So my question is how do I populate the value attribute of the form fields
that are created in a loop with the initial empty variables that were also
created in a loop? Basically I want the value attribute of the form fields
to be value="#variables.stPeople.stPerson1.firstName#" and the stPerson1
changes numbers as the loop increments. Is it just a matter of using the
proper syntax? If so I am missing it completely.
Hopefully I have expressed myself clearly!
Thanks,
Nate
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

