Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you halt processing in a CFSCRIPT block?

CFSCRIPT

How do you halt processing in a CFSCRIPT block?

by  Glowball  Posted    (Edited  )
Unfortunately, there is no equivalent to
Code:
<CFABORT>
for a CFSCRIPT block. You can write a fairly simple workaround using variables, however.
Code:
<cfscript>
keepGoing = 1;        // the default is to keep going
myvar = 2;            // set working variable
    keepGoing = 0;    // we want to abort here
    break;
myvar = 3;            // if the abort doesn't work, we'll know
</cfscript>
<cfif keepgoing>
    <cfoutput>#VARIABLES.myvar#</cfoutput>
<cfelse>
    <cfabort>
</cfif>
This should output the number 2, meaning we got the processing to stop.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top