Terminating tag execution

Within a custom tag, you typically perform error checking and parameter validation. As part of those checks, you can choose to abort the tag, using cfabort, if a required attribute is not specified or other severe error is detected.

The cfexit tag also terminates execution of a custom tag. However, the cfexit tag is designed to give you more flexibility when coding custom tags than cfabort. The cfexit tag's method attribute specifies where execution continues. The cfexit tag can specify that processing continues from the first child of the tag or continues immediately after the end tag marker.

You can also use the method attribute to specify that the tag body executes again. This enables custom tags to act as high-level iterators, emulating cfloop behavior.

The following table summarizes cfexit behavior:

Method attribute value Location of cfexit call Behavior

ExitTag (default)

Base page

Acts like cfabort

ExecutionMode=start

Continue after end tag

ExecutionMode=end

Continue after end tag

ExitTemplate

Base page

Acts like cfabort

ExecutionMode=start

Continue from first child in body

ExecutionMode=end

Continue after end tag

Loop

Base page

Error

ExecutionMode=start

Error

ExecutionMode=end

Continue from first child in body


View comments in LiveDocs