Login Register

Download Button

Hello,

i am using a simple Form which needs to be filled to download an PDF.
i am currently using this code, which does not validate the fields up to now. I just wnat to get the download function working at first.

dojo.require("dojo.parser");
       dojo.require("dijit.form.Button");
       dojo.require("dijit.Dialog");
       dojo.require("dijit.form.TextBox");
       function getFile(dialogFields) {
                        dijit.byId("download").setHref('test.pdf');
                        _uacct = "UA-2991601-2";
                        javascript:urchinTracker('test.pdf');
                   console.debug("Button was clicked.");
       }

When i press the button, the file gets loaded in to the browser as raw data. No PDF-Reader will be launched. How to fix this?

Thanks
Peter

Is possible, I think:

In the sample code for the moj.oe demo:

http://svn.dojotoolkit.org/src/demos/trunk/mojo/src/download.js

The init() function specifically, it uses dojo.io.iframe.send({ url:"somefile.tar.gz", timeout:4000 }); the timeout is required because no load: callback will be fired, so you'll want it to "fail" silently and release the iframe transport, otherwise no other io.iframe sends will be sent.

hope this helps.