User Guide

184 CFML Language Reference
CFSCRIPT
The CFSCRIPT tag encloses a code segment containing CFScript.
Syntax <CFSCRIPT>
CFScript code goes here
</CFSCRIPT>
Usage Use CFSCRIPT to perform processing in CFScript instead of CFML. Note the following
regarding CFScript:
CFScript uses ColdFusion functions, expressions, and operators
You can read and write ColdFusion variables inside of CFScript
One use of CFSCRIPT is to wrap a series of assignment functions that would otherwise
require CFSET statements.
For more information on CFScript, see Developing Web Applications with ColdFusion.
Example <!--- This example shows the use of CFSCRIPT --->
<HTML>
<HEAD>
<TITLE>CFSCRIPT Example</TITLE>
</HEAD>
<BODY bgcolor=silver>
<H3>CFSCRIPT Example</H3>
<P>CFSCRIPT adds a simple scripting language to ColdFusion
for those developers who are more comfortable with JavaScript
or VBScript syntax.
<P>This simple example shows variable declaration and
manipulation.
<CFIF IsDefined("form.myValue")>
<CFIF IsNumeric(form.myValue)>
<CFSET x= form.myValue>
<CFSCRIPT>
y = x;
z = 2 * y;
StringVar = form.myString;
</CFSCRIPT>
<CFOUTPUT>
<P>twice #x# is #z#.
<P>Your string value was: <B><I>#StringVar#</I></B>
</CFOUTPUT>
<CFELSE>
...