3-1-Tags:CFAbort
last edited by
lmajano
on 23-Aug-2009
cfabort
Description
Stops processing of a page at the tag location. Railo returns everything that was processed before the cfabort tag. The cfabort tag is often used with conditional logic to stop processing a page when a condition occurs.
Category
Other
Implemented
Usage Syntax
<cfabort [showError="String"] [type="String"] />
[] = Optional attribute
Attributes
| Name | Type | Required | Default | Description |
| showError | String | No | The error to display when cfabort executes. The error message displays in the standard CFML error page. | |
| type | String | No | Define if only current page execution will aborted or the whole request. Values are "page" for the current page or "request" for all. |
Example Usage
Example 1:
<cfset variables.foo = "2"> <cfoutput>#variables.foo#</cfoutput> <cfabort> <--- This will never run as we have halted processing ---> <cfset variables.foo = incrementValue(variables.foo)> <cfoutput>#variables.foo#</cfoutput>
Example 2:
<cfset variables.foo = "2"> <cfset variables.msg = "This is an custom error that I can write. This will display as a message to the user and all processing is halted."> <cfabort showError="#variables.msg#"> <cfoutput>#variables.foo#</cfoutput>
SideBar
User Login
Comments (