Probably the best way to do it would be using the Evaluate() funciton:

<cfif isdefined("form.go")>
  <cfloop index="loopitem" from="1" to="3">
  <cfoutput>
    #Evaluate("form.input" & loopitem)# <!--- should be the right
syntax --->
  </cfoutput>
  </cfloop>
</cfif>


-----Original Message-----
From: Clare [mailto:[EMAIL PROTECTED]]
Sent: Monday, 28 May 2001 3:57 PM
To: CF-Talk
Subject: Dynamic loop variables (or embedded #)


This is my first post so please be gentle.

I am trying to work out what syntax will reference dynamic variables within
dynamic variables, I am generating a dynamic number of text inputs in my
form but can't work out how to reference them in the #form.name# output. I'm
sure this is easy if you know how.  Please help.

Clare

<form action="self.cfm" method="post">
  <cfloop index="loopitem" from="1" to="3">
    <cfoutput><input type="text" name=input#loopitem#></cfoutput>
  </cfloop>
  <input type="submit" name="go">
</form>

<cfif isdefined("form.go")>
  <cfloop index="loopitem" from="1" to="3">
  <cfoutput>
    #form.input#loopitem## <!--- obviously the wrong syntax --->
  </cfoutput>
  </cfloop>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to