[thelist] CF smoke and mirrors

Raymond Camden jedimaster at macromedia.com
Thu Jul 19 08:06:11 CDT 2001


You can only evaluate expressions, not tags. For example, this is bad:

<CFSET Evaluate("<CFSET X = 1>")>

<CFOUTPUT>#X#</CFOUTPUT>

this is ok:

<CFSET Evaluate("X = ""ray""")>
<CFOUTPUT>#X#</CFOUTPUT>

If you want to param a dynamic name, just use a variable!

<CFSET VAR = "records">
<CFPARAM NAME="#var#" DEFAULT="">

This will set records equal to "" if it doesn't already exist.

Warning! This is a bit off topic, but you should be aware: When you CFPARAM
records.type, or anything (dot) anything, you are NOT creating a structure
called Records with a Key called type. You are creating a variable called
"records.type". While this isn't horrible or anything, it really isn't
proper.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email   : jedimaster at macromedia.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of
> Rory.Plaire at wahchang.com
> Sent: Wednesday, July 18, 2001 9:57 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] CF smoke and mirrors
>
>
> Evoltarians,
>
> I am somewhat confounded with the following code:
>
> <cfset p1 = "<cfparam name=""records.type"" default="""">">
> <cfscript>
> 	Evaluate(p1);
> </cfscript>
>
> The purpose is to write a cfparam tag as a string and evaluate it
> to get the
> actual parameter, which is then used elsewhere.
>
> The problem is this error:
> <err>
>   An error occurred while evaluating the expression:
>





More information about the thelist mailing list