Your Rating: Results: PatheticBadOKGoodOutstanding! 6 rates

Description

Stops the processing of a ColdFusion page at the tag location. ColdFusion returns everything that was processed before the tag. The tag is often used with conditional logic to stop processing a page when a condition occurs.

Category

Flow-control tags

Syntax

Note

You can specify this tag's attributes in an attributeCollection whose value is a structure. Specify the structure name in the attributeCollection and use the tag's attribute names as structure keys.

See also

cfbreak, cfexecute, cfexit, cfif, cflocation, cfloop, cfswitch, cfthrow, cftrycfabort and cfexit in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

showError

Optional

 

Error to display, in a standard ColdFusion error page, when tag executes.

Usage

When you use the cfabort and cferror tags together, the cfabort tag halts processing immediately; the cferror tag redirects output to a specified page. If this tag does not contain a showError attribute value, processing stops when the tag is reached and ColdFusion returns the page contents up to the line that contains the cfabort tag.
When you use this tag with the showError attribute, but do not define an error page using cferror, page processing stops when the cfabort tag is reached. The message in showError displays to the client.When you use this tag with the showError attribute and an error page using cferror, ColdFusion redirects output to the error page specified in the cferror tag.

Note

When using cfabort, cflocation, or cfcontent tags, the OnAbort method is invoked instead on OnRequestEnd.

Example

This example shows the use of cfabort to stop processing. In the second example, where cfabort is used, the result never displays.

Labels
  • None
  1. Nov 09, 2012

    CFSCRIPT EQUIVELANT

    <cfscript>
        // ...
        if (Counter eq 2) {
            //... some stuff
            abort;
        }
    </cfscript>
  2. Nov 20, 2013

    So there is no way to pass a message via showError like the tag version even though in the section under Tags without BodiesTags shows this as the example:

    • cfabort: abort ["message"];
    Let alone the [ ] make less sense then if they were ( ).

Searching ColdFusion, English documentation