Copy link to clipboard
Copied
Hello, all,
I'm submitting a form to itself (form target is set for an iframe on the same page) to generate an Excel file and offer it to the user for either download or open. So far, everything is working great except one minor thing.
When the form submits, I add an animated circle 'progress' image to imply working in the background. Once CFHEADER and CFCONTENT offer the file, I'm trying to get the gif to detach or hide.
I've tried using the iframe onLoad and onChange, but apparently that isn't being triggered. Is there another way to trigger some kind of event when the file is offered?
<form target="exportToExcel" method="post" enctype="application/x-www-form-urlencoded">
...<select id="FQDN" name="FQDN">...</select>
</form>
<iframe id="exportToExcel" width="1" height="1" src="about:blank"></iframe>
Javascript:
FQDN = document.getElementById('FQDN');
... // set FQDN onchange to submit the form
ifrm = document.getElementById('exportToExcel');
ifrm.onload = function(){return function(){mc.innerHTML = ''}}; //I've also tried removeChild(), no worky.
V/r,
^ _ ^
Copy link to clipboard
Copied
Im assuming the iFrame is on the same domain?
Does developer console say anything when trying this?
Copy link to clipboard
Copied
Hi, haxtbh,
I tried several times yesterday to log on and let everyone know that I found a workaround. Stupid servers couldn't log me on.
Sadly, I will have to come back later to let everyone know how I did it. We were just informed yesterday that we have until COB tomorrow to vacate the room that we are in so another department can have it. So we are packing and moving.
V/r,
^ _ ^
Copy link to clipboard
Copied
Sorry for taking so long to get back. As the department lead developer, department FACCSM, and department EC (Equipment Custodian), I had a lot of equipment and other things that demanded my attention during this move.
My workaround has only been tested in FireFox, but I'm about to test it in IE and Chrome.
What I was doing incorrectly was trying to use .onload and .onchange to detect when the file was done downloading.
My fix was to use:
ifrm.addEventListener('load',mc.removeChild(imge),false);
This appears to be working.
V/r,
^ _ ^
UPDATE: Sorry, I didn't answer your question. Yes, same domain. No error messages in dev con.
Copy link to clipboard
Copied
This post is really old but I was curious if you had a complete code snippet for your solution.
Is 'imge' your overlay image?
I'm trying to do something similar - using FW1 - user clicks on a button (which I disable), then create a spreadsheet with cfspreadsheet and serve that with cfcontent/header but can't go back and re-enable the submit button afterwards.
Thanks!
Jim
Copy link to clipboard
Copied
Hi, Jim,
Unfortunately, I do not. This was two years ago, and I honestly don't even remember which project this was for.
Oh, to have eidetic memory would be so cool in instances like this.
V/r,
^ _ ^
Copy link to clipboard
Copied
I might be missing something here, but you won't be able to add any script to the URI that's returning your file. Instead, you'll need additional script in the document that's opening the file in the iframe - you'll need an event handler to identify when the content has finished loading in the iframe. This might be a good start.
javascript - Capture iframe load complete event - Stack Overflow
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
What I ended up doing
A bit clunky but it works and the client is happy.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Jim+Priest wrote
A bit clunky but it works and the client is happy.
And in the end, that's really the only important thing.
V/r,
^ _ ^