I have a form that allows the user to add co-authors so I'm trying to loop through those fields (if they exist) but can't seem to be able to get the values. "coauthorNo" is a hidden input field that only exists if the user adds 1 or more co-authors. I'm testing with a cfoutput in my page to see if I can get the values but no luck thus far. This is running on a Coldfusion 10 server.
<cfif IsDefined("FORM.coauthorNo")>
<cfset coAuthCount = listLen("#FORM.coauthorNo#", ",")>
<cfloop from="0" to="#coAuthCount#" index="i">
<cfset CoAuthF = "#FORM['CoAuthFirstName'&i]#">
<cfset CoAuthL = "#FORM['CoAuthLastName'&i]#">
<cfoutput>CoAuth's: #CoAuthF#, #CoAuthL#,</cfoutput>
</cfloop>
</cfif>
Edit: Changed the cfloop from value to 1 and that fixed it. My dynamically created form fields started at 1 vs 0. ie CoAuthFirstName1