I think you already answered your own question…

“Do something magic and ABORT the request so the page doesn’t change”

</cfabort>, maybe trigger a warning message to appear that something’s gone 
wrong…

From: houcfug@googlegroups.com <houcfug@googlegroups.com> On Behalf Of Mike G
Sent: 12 July, 2019 11:41 AM
To: houcfug@googlegroups.com
Subject: [houcfug] A BrainTeaser for ya...

[EXTERNAL EMAIL]
So, I have a page where folks are submitting shipment info and getting a label 
back to the browser in pdf format using cfcontent, cfheader in a separate page 
called getLabels.cfm.  All the shipment processing is Ajaxy and wonderful, and 
at the end a bit of javascript says...
window.location.replace("/pathTo/getShippingLabel.cfm?invoice="+o.invoice);

Simple and easy, normal stuff, been there, done that a million times..

<cfheader name="Content-Disposition" value="attachment; 
filename=labels-#url.invoice#.pdf">
<cfcontent type="application/unknown" 
file="#application.props.getproperty("labelsPath","")##url.invoice#.pdf">

So, here is the brain teaser. (and yeah, I left all the other code out)

When the label pdf doesn't exist, how to I stop the original calling page from 
going to getLabels.cfm and displaying "File not found" message?  I want the 
user to stay on the page they are working in.

Instead I would like to do this in getLabels.cfm

<cfif not 
fileexists("#application.props.getproperty("labelsPath","")##url.invoice#.pdf")>
Do something magic and abort the request so the page doesn't change
<cfelse>
<cfheader name="Content-Disposition" value="attachment; 
filename=labels-#url.invoice#.pdf">
<cfcontent type="application/unknown" 
file="#application.props.getproperty("labelsPath","")##url.invoice#.pdf">
</cfif>

in 20 years of CF, I have never tried this...

M
--
--
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to 
houcfug-unsubscr...@googlegroups.com<mailto:houcfug-unsubscr...@googlegroups.com>
For more options, visit http://groups.google.com/group/houcfug?hl=en

---
You received this message because you are subscribed to the Google Groups 
"Houston ColdFusion Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
houcfug+unsubscr...@googlegroups.com<mailto:houcfug+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/houcfug/CAKb7GJME%3DrtnZ5ebYPGWi62Aye9XSF1a1dCzfMdd%2BewtRw3vXw%40mail.gmail.com<https://groups.google.com/d/msgid/houcfug/CAKb7GJME%3DrtnZ5ebYPGWi62Aye9XSF1a1dCzfMdd%2BewtRw3vXw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

Disclaimer

The information contained in this communication from the sender is 
confidential. It is intended solely for use by the recipient and others 
authorized to receive it. If you are not the recipient, you are hereby notified 
that any disclosure, copying, distribution or taking action in relation of the 
contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been 
automatically archived by Mimecast Ltd, an innovator in Software as a Service 
(SaaS) for business. Providing a safer and more useful place for your human 
generated data. Specializing in; Security, archiving and compliance. To find 
out more visit the Mimecast website.

-- 
-- 
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to houcfug-unsubscr...@googlegroups.com
For more options, visit http://groups.google.com/group/houcfug?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Houston ColdFusion Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to houcfug+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/houcfug/1D78C19BC5AD1A4C8EE8AB90BBD2E548DCC04AC3%40ALNEXMBXN303.bakerbotts.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to