Setvariable - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

SetVariable

Description
This function is no longer required in well-formed ColdFusion pages.
Sets a variable in the
Returns
The new value of the variable.
Category
Dynamic evaluation functions
Function syntax
SetVariable(name, value)
See also
DE, Evaluate,
Parameters
Parameter
name
value
Usage
Before this function is called, the client variable must exist, and the
ClientManagement
You can use direct assignment statements in place of this function to set values of dynamically
named variables. To do so, put the dynamically named variable in quotation marks and pound
signs (#); for example:
<cfset DynamicVar2 = "ABD">
<cfset "#DynamicVar2#" = "Test Value2">
Also, the following lines are equivalent:
<cfset "myVar#i#" = myVal>
SetVariable("myVar" & i, myVal)
For more information, see
ColdFusion MX Applications.
Example
<h3>SetVariable Example</h3>
<cfif IsDefined("FORM.myVariable")>
<!--- strip out url, client., cgi., session., caller. --->
<!--- This example only lets you set form variables --->
<cfset myName = ReplaceList(FORM.myVariable,
"url,client,cgi,session,caller", "FORM,FORM,FORM,FORM,FORM")>
<cfset temp = SetVariable(myName, FORM.myValue)>
<cfset varName = myName>
<cfset varNameValue = Evaluate(myName)>
<cfoutput>
680
Chapter 3: ColdFusion Functions
parameter to the value of the
name
IIf
Description
Variable name
A string, the name of a string, or a number
attribute must be set to "
Chapter 4, "Using Expressions and Pound Signs,"
parameter.
value
".
Yes
tag
cfapplication
in Developing

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents