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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CF equivalent of response.clear

Status
Not open for further replies.

cash0

Programmer
May 23, 2001
22
AU

Is there an equivalent ColdFusionMX command to response.clear in ASP?

I have an error handler function that displays an error message when an error occurs. But, since the error is likely to occur half way through processing the page, some page output is likely to have been processed ready to be displayed on the screen. I'd rather clear all the page output, and just display the error message without anything else.

For reasons which I don't have the energy to explain here, I would rather not use cflocation to go to another page, and I don't want to use cferror.

Any ideas? Thanks.
 
This is the opposite of what most people usually need to do: output partial page data via ColdFusion. Now that we have the cfflush tag (since version 5), we have that capability. What you want to do, though, is NOT display any output on the page until it's all be rendered appropriately. If it hasn't been, then you want to throw the error.

Check out the
Code:
<cfsavecontent>
tag. Basically it allows you to save content between the opening and closing tags, assign it to a variable, and display or manipulate that variable how you see fit. One of our clients, who always does web surveys for their various products, has HUGE forms. CFSAVECONTENT is a plus for this, because (luckily) they want the actual forms returned to them as they were filled out (in an HTML email). I can run the form through cfsavecontent and then just dump the variable (which contains the HTML of the survey) right into cfmail, without writing any lengthy formatting routines!

-Tek
 
I've decided to just use cflocation to load an error page. Probably the smarter option anyway. Cfsavecontent may not be all that practical in this instance, but I can see how it can really be useful.

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top