The property document.readyState can be used to get the current status
of any document... I forget all the possible states it can return, I
always only check for "complete" to trigger some event when the page
loads. You can use this to check the status of the child window as long
as you keep a reference to it when you open it.
I don't think this will work if you simply load the CSV into the child
though... Give it a try, but I'm not sure when readyState will return
complete, assuming it does at all, when a save as dialog is in play.
Frank
Balasubramaniam, Sezhiyan wrote:
Hi Frank,
Thanks a lot for taking time to explain the options.
Based on our requirements, the option 3 looks more promising to me (we
already use frames for this solution)
BTW, is there anyway, I can check the child window document status from
the main widow, in this case?
As the result comes in the dialog, which event or attribute may indicate
the main window about the successful csv download on the child window?
As a note, we took care of multiple submissions by disabling the button.
Once again thanks.
-----Original Message-----
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, July 25, 2005 4:10 PM
To: Struts Users Mailing List
Subject: Re: JavaScript question?
Hi Sezhiyan,
There isn't any "standard" way of doing this... what's happening is that
the request is coming back just like any other would that updates what
the user sees. As you mentioned though, the save as dialog appears
instead... there is no event you can hook that will tell you when the
page is loaded because, in essence, the browser is expecting a new page
that would overwrite any event you could hook even if one existed.
There's a couple of ways I can think of to do this...
(1) Perhaps the easiest is to target your form submission (or link) that
gets the CSV to _new. This will open a popup that will be the target of
the return... since it's a save as dialog, the popup should, I believe,
go away, leaving just the save as dialog. This wouldn't help you
determine when to change back to the default cursor though... you could
kick off a timer to change it back in a few seconds.
Before I forget, note that changing to an hourglass isn't stopping the
user from clicking more than once, it's just a visual cue that they
shouldn't. You may want to disable the button instead of changing
cursors. The same problem of knowing when to change back applies though
:)
(2) Use AJAX to get the CSV, then display it to the user, perhaps in a
new window, perhaps in a <div> on the same page. You'll know exactly
when to switch the cursor back in this case.
(3) If you can use frames, have a hidden frame (cols/rows=0) and target
that... you can then kick off a timer in your main frame that checks the
document status. When its complete, change the cursor back.
(4) Kind of a hybrid of 1 and 3... open a new window, and in response to
onLoad, make the call that gets the CSV... Put a message that says
"After the Save As dialog appears, please click here" and when they
click here, call a function back in the parent window that resets the
cursor.
Hope that helps!
Frank
Balasubramaniam, Sezhiyan wrote:
Though this is not a direct struts question, hope I will some guidance
for my issue.
In one of our struts application, we have a CSV download
functionality.
We use response.setContentType("application/csv;").
When the download happens, user has no clue about the state of the
request and keeps on clicking the submit button.
So we changed cursor to hour-glass on the form submit. This technique
works well with the other pages where response shown in the browser
itself.
But in the csv download, the page stays as it is, but the response
comes
as a windows dialog for saving it or to open it.
What happens is, even after the download, the mouse stays as
hourglass.
Can somebody advice me, which event, we have to look for, to turn the
mouse to default, after the page download?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]