MACROMEDIA COLDFUSION MX 61-CFML Reference page 109

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

Advertisement

<p>cfexit is used primarily to perform a conditional stop of processing
inside a custom tag. cfexit returns control to the page that
called that custom tag, or in the case of a tag called by another
tag, to the calling tag.
<!--- cfexit can be used within a CFML custom tag, as follows: --->
<!--- Place this code (uncomment the appropriate sections) within the
CFUSION/customtags directory --->
<!--- MyCustomTag.cfm --->
<!--- This simple custom tag checks for the existence
of myValue1 and myValue2. If they are both defined,
the tag adds them and returns the result to the calling
page in the variable "result". If either or both of the
expected attribute variables is not present, an error message
is generated, and cfexit returns control to the
calling page. --->
<!--- <cfif NOT IsDefined("attributes.myValue2")>
<cfset caller.result = "Value2 is not defined">
<cfexit method = "exitTag">
<cfelseif NOT IsDefined("attributes.myValue1")>
<cfset caller.result = "Value1 is not defined">
<cfexit method = "exitTag">
<cfelse>
<cfset value1 = attributes.myValue1>
<cfset value2 = attributes.myValue2>
<cfset caller.result = value1 + value2>
</cfif> --->
<!--- End MyCustomTag.cfm --->
<!--- Place this code within your page --->
<!--- <p>The call to the custom tag, and then the result:
<CF_myCustomTag
myvalue2 = 4>
<cfoutput>#result#</cfoutput> --->
<p>If cfexit is used outside a custom tag, it functions like a cfabort.
For example, the text after this message is not processed:
<cfexit>
<p>This text is not executed because of the cfexit tag above it.
cfexit
109

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents