There is a function called Evaluate() that is pretty useful for these tasks:

<cfif isdefined("form.go")>
  <cfloop index="loopitem" from="1" to="3">
  <cfoutput>
    #evaluate("Form.Input#loopitem#")#
  </cfoutput>
  </cfloop>
</cfif>

Also, if you are using CF 4.5x you can refer to the form fields using the
"Form Structure" and do your sting concatenation at the same time:

<cfif isdefined("form.go")>
  <cfloop index="loopitem" from="1" to="3">
  <cfoutput>
    #Form['input' & loopitem]#
  </cfoutput>
  </cfloop>
</cfif>

A little more about the "Form Structure":
http://cfhub.com/advanced/cfloop/collection.cfm


> 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