> Adam,
>       I need to take HTML form and take those form field to populate a
> word document that the user can then print.  I'm using a CF page to red in
> the template document (RTF) file and then replace placeholders with the form
> data.  I then use the cfcontent tag to allow the user to print of save the
> resulting word document.  

Oh.

So you want to do this:
1) create the world doc
2) use <cfcontent> to deliver to the browser as an attachment so they can
save it (NOT display it).
3) go somewhere else after they save it.

I see.

Do this:

<!--- resultPage.cfm --->
<cfheader name="refresh" value="2;url=./downloadPage.cfm">
This is the final destination

<!--- downloadPage.cfm --->
<!--- This is the page that generates the Word document, saving it as
/worddata.txt--->
<cfheader name="content-disposition" value="attachment;filename=test.doc">
<cfcontent type="application/msword" file="/worddata.txt">

Browse to resultPage.cfm.

Now, the thing is you're doing things the reverse of what you think you
might.  There's no way of getting around the two requests issue... you
can't do it in one hit.  But you can make it look like you're doing it in
one hit.

What you do is go to the URL in step (3) first.  At the top of that, you
have a redirect to the URL in step (2).  Because <cfheader>/<cfcontent>
sets that to be an attached Word doc, it doesn't affect the on-screen
browser display, and all you get is the file download pop-up.  I'm guessing
some browser settings might block the redirect, hence you'll see most sites
that do this present a link saying "if you're download doesn't start
immediately, click here".  That link would go to the URL in step (2).

Does that sort your situation out?

Adam

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to