I have a form on my page that generates a large PDF file (can take up to 20 seconds). Is there a way to show a throbber while the download file is being created and to hide it when the download prompt appears?
I did some checking, initially thought I could use progressive display, but figured that's not its purpose.
I figured I could attach a JS function that will trigger showing my throbber when the "Download" button is clicked, but I'm not so sure how to hide it when the download window appears.
Is there a way to do this in Tapestry?
Possibly a better solution is to NOT submit the form. You could use javascript to construct a GET url and use an iframe.
eg:
<form>
<input id="someText" />
<button onclick="downloadPdf()">Click Me</button>
</form>
<script>
function downloadPdf() {
var url = "/path/to/pdf?someText=" + encodeURIComponent($("#someText").val());
startThrobber();
$('<iframe src="' + url + '" onLoad="stopThrobbber()">').appendTo('body');
}
</script>