yes you can do it. i use Evaluate() with dynamic values all the time.
try removing the " from "#id#". if that doesn't work (it should), try
something like:
<cfset thelist = "">
<cfloop from="1" to="3" index="id">
<cfset tempvalue = form.fieldnum&#id#>
<cfset thevalue = Evaluate(tempvalue)>
<cfset thelist = ListAppend(thelist, thevalue)>
</cfloop>
-----Original Message-----
From: Andy Ewings [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 8:23 AM
To: CF-Talk
Subject: Dynamic variable names
Can you have dynamic variable names in CF?....e.g in an action page could
you have something like -
<cfset thelist = "">
<cfloop from="1" to="3" index="id">
<cfset thevalue = Evaluate(form.fieldnum & "#id#")>
<cfset thelist = ListAppend(thelist, thevalue)>
</cfloop>
where there are form fileds fieldnum1, fieldnum2, and fieldnum3.
I have tried this but it doesn't work.....I thought you might be able to use
the Evaluate function in this way as this works (from the Forta book):
<cfset x = "Array">
<cfset EVALUATE("p = " & x & "New(1)")>
This creates a new array stored in the variable p
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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