Cfabort - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

Chapter 1: ColdFusion Tags

CFABORT

The CFABORT tag stops processing of a page at the tag location. ColdFusion simply
returns everything that was processed before the CFABORT tag. CFABORT is often
used with conditional logic to stop processing a page because of a particular
condition.
Syntax
<CFABORT SHOWERROR="text">
SHOWERROR
Optional. Specify the error you want to display when CFABORT executes. This
error message appears in the standard ColdFusion error page.
Usage
When combining CFABORT and CFERROR, remember that CFERROR is meant to
redirect output to a specified page. CFABORT is intended to halt processing
immediately.
If the CFABORT tag does not contain a SHOWERROR attribute value, processing stops
immediately and the page contents are shown all the way up to the line containing the
CFABORT tag.
When using CFABORT with SHOWERROR by itself (that is without defining an error
page using CFERROR) page processing stops once the CFABORT tag is reached and the
message defined in SHOWERROR is displayed to the client.
If you have a page in which you've defined both an error page using CFERROR and a
CFABORT tag using the SHOWERROR attribute, ColdFusion redirects output to the
error page specified in the CFERROR tag.
Example
<!--- this example demonstrates the use of CFABORT
to stop the processing of a CFLOOP.
where CFABORT is used, the result never appears --->
<HTML>
<HEAD>
<TITLE>CFABORT Example</TITLE>
</HEAD>
<BODY bgcolor=FFFFFF>
<H1>CFABORT Example</H1>
<P>
<H3>Example A: Let the instruction complete itself</H3>
<!--- first, set a variable
<CFSET myVariable = 3>
<!--- now, perform a loop that increments this value --->
<CFLOOP FROM="1" TO="4" INDEX="Counter">
<CFSET myVariable = myVariable + 1>
</CFLOOP>
<CFOUTPUT>
Note that in the second example,
--->
9

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents