You can't typically instantiate a file download of an embedded object in a
div.
I may be wrong but i've never seen it done.
Usually, if you want to start a download, you use http headers and an
iframe. You can set it to download or embed.
If you want to download, you can set the width/height of the iframe to 0.
I would build what you want in 2 requests- one to validate the data and save
it, and the other to generate the pdf from the saved data.
Call the first request
Get the result
If the result is "ERROR" then stick it in the div
If the result is "OK" then get the resulting url, if it has to be generated
from the data and add a new iframe to your document to instantiate the
download.
Here is some cross browser add-iframe code.
It is not prototype.
function addIframe (url) {
if (document.all)
document.body.insertAdjacentHTML('beforeEnd',
'<IFRAME WIDTH="0" HEIGHT="0" SRC="' + url + '"><\/IFRAME>');
else if (document.getElementById) {
var ifr = document.createElement('IFRAME');
ifr.src = url;
ifr.width = 0;
ifr.height = 0;
document.body.appendChild(ifr);
}
}
On 3/14/07, oldandgrey <[EMAIL PROTECTED]> wrote:
>
>
> I'm trying to use the ajax.Updater function to send a message to the
> server and display an error message. Ok so far. However if the server
> detects no error with the data sent I want to open a PDF file in a new
> window. When I try to do this (using fpdf) the returned PDF is opened
> as text in the error div.
>
> Can anyone point me in the right direction.
>
> rgds
>
> gmcb
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---