[thelist] ColdFusion function for dynamic variable name?

Chris Evans chris at fuseware.com
Tue Jul 10 13:16:31 CDT 2001


Evaluate() :

<cfset listFields = "Field1, Field2, Field3, Field4">

<cfloop list="#listFields#" index="field" delimiters=",">
	<cfif (Evaluate("old#field#") is not Evaluate("request#field#"))>
		<!--- Do whatever. --->
	</cfif>
</cfloop>

Hope that helps,

Chris Evans
chris at fuseware.com
http://www.fuseware.com



-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Plunkett, Matt
Sent: Tuesday, July 10, 2001 1:55 PM
To: thelist at lists.evolt.org
Subject: [thelist] ColdFusion function for dynamic variable name?


Howdy-

Is there a function in ColdFusion that will let me construct variable names
from strings and then use them as variables?  Hopefully the code below will
help:

I have two sets of form fields, one hidden and one from various inputs.  The
hidden ones are all called oldField1, oldField2, oldField3, and so on and
the others are called requestField1, requestField2, and so on.

I want to compare oldField1 to requestField1 and so on...as my imaginary
function Foo is trying to do.

<cfset listFields = "Field1, Field2, Field3, Field4">

<cfloop list="#listFields#" index="field" delimiters=",">
	<cfif (Foo("old" & #field#) is not Foo("request" & #field#))>
		<!--- Do whatever. --->
	</cfif>
</cfloop>

Thanks,
Matt

---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !






More information about the thelist mailing list