CF6: download of file using download action does not finish

Erik66 08 Jan, 2019
I have created a form where a PDF file is downloaded. The file downloaded depends on a selection made in the form. That part of the form is working alright. I use a 'download' action to retrieve the file to be downloaded and set the list of allowed extensions to be blank so I always get a 'save file' dialogue before downloading. This also works fine. The file is also downwloaded alright. But the the form itself hangs with the indicator that a form is being downloaded being shown infinitely. Consequently, the action after the download action, a redirect to the previous form, is not reached and executed.

I tried changing templates to see if anything in the template might be conflicting. That seems not to be the case. I also disabled the popup window in which the form was shown. This also made no difference. Neither COnsole nor Debugger windows of the browsers used offer any output that explains what is going on.

Does anyone have an idea what may be causing the download to hang?

Many thanks in advance,

healyhatman 08 Jan, 2019
More than likely there's an error of some sort. Try using a {debug:} line and get rid of the download action, make sure everything else is working properly, then put the {fn:download} back in. Check that you have a valid filename entered and whatnot.
GreyHead 08 Jan, 2019
Hi Erik,

If you use a download action ChronoForms loses control of the process and nothing after that will be processed. Better to use a download link in your 'Thank You' page.

Erik66 08 Jan, 2019
Thank you healyhatman for the suggestions. I disabled and debugged a lot and everything works alright except for the download action. And GreyHead, that's an interesting fact and suggestion. I think I'll go for that. A shame though, that the download action doesn't work as I hoped for. Is there anything being done on that in development?
healyhatman 09 Jan, 2019
From further reading, it's not a Chronoforms thing it's a way-the-internet-works thing, so you'd need to talk to Al Gore and Tim Berners-Lee.

You could code up a bunch of stuff in Javascript and add additional events with data reads and whatnot to your form, but you're better off just doing what Bob said and having a download link displayed on the page. It should be something along the lines of
<a href="{url:download}&file={var:file_name_to_download_or_some_sort_of_code}">Click to download</a>
Then you need to create a download event, and put the download action in that.
healyhatman 09 Jan, 2019
UPDATE The following code should work. DON'T copy paste from the forums, it adds hidden characters. Type it manually.

Put it in a Javascript block, with the DOM Ready box ticked.
window.location = "{url:download}&code=code_or_file_name_or_whatever";

You will still need a link, in case the user has JS turned off.
Erik66 09 Jan, 2019
Thanks for the suggestions healyhatman !
This topic is locked and no more replies can be posted.