File download

Hi!

I’m using Designer 7.1.

When the user clicks on a link/button/image I want a file to be downloaded and displayed in a new browser window.

I copied the code from the wm_caf_misc/fileexport sample. In the action I return the file using the BasePageBean.streamFileDataToResponse() method.

I have two problems:

  1. After the action is invoked all buttons in the form remain inactive. This also happens in the sample. So my guess is that the form gets no acknowledge back from the server.

  2. I want the file to be opened in a new browser window (or tab). If I use a command link and set the target property to _blank a new window/tab is openend but no file is downloaded. The only thing that works is to set forceDownload in streamFileDataToResponse() to true. Then the file is opened in the associated application but not in the browser.

Bye,
Guenter

Hi,

I was also facing the same problem (Both of them). I managed a workaround for the first one though.
Try doing this, on the onBlur property of the command link, put this script:
Form.enableButtons(document.body);

Maybe not the correct solution, but worth a try.