aspose file tools*
The moose likes Struts and the fly likes execute action when window.close() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "execute action when window.close()" Watch "execute action when window.close()" New topic
Author

execute action when window.close()

Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
Hello!


I have a parent window and i open a pop-up window. I want to execute an action and to close the pop-up in same time.

I put the onklick = window.close event handler on submit button.

Now it works (very) strange:
sometimes it does execute the struts action and close the window
BUT sometimes it only closes the window (without executing the action)

How can I fix this?


Regards
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I think the problem is that you have a race condition between the submit and the onclick. I assume they are a synchronus and if your computer manages to execute the close first the submit won't happen. I'd suggest using a button and in the onclick event submit your form and then do your window.close. That should force them to happen one after teh other.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute action when window.close()