<form name="input" action="html_form_action.cfm" method="post"> id <input type="text" name="id" /> <input type="submit" value="Submit" /> </form>
Here is the ColdFusion action page code:
<cfapplication name="arrays" clientmanagement="Yes" sessionmanagement="Yes"> <cfif !isDefined('form.id')> <cfset session.urlid = form.id> <cfset session.arrData[(arrayLen(session.arrData)+1)] = #session.urlid#> </cfif> <cfloop array=#session.arrData# index="name"> <cfoutput> <form name="input"> item<input type="text" name="id" placeholder=#name#> </form> </cfoutput> </cfloop>
Is this along the correct lines to do this? I have been reading the documentation trying to understand the help there but its a bit too much for me. My understanding of the problem was to create a session, create an array, items added to the array are stored in the session, but I am getting errors such as this:
Object of type class coldfusion.runtime.Struct cannot be used as an array
I was thinking that I need to check if the array is defined?
I would appreciate any advice on this at all!