• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browser X Button

 
Prasad Babu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to submit the form in a page when the user press the Browser window 'X' Button.(only press the 'X' button). of course some events like onunload useful but these events are called eac time when not even pressing the X button. i.e. from other source.

Any idea?

Thanks in advance,
Prasad
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The onunload and onbeforeunload are called for anything that causes the browser to leave its current state. Basically there is no easy solution to solving the problem.

Eric
 
Prasad Babu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thanks for the reply. In my scenario,

One popup window will be opened to edit a form contains some fields to be persisted. in that window I ahve two buttons, one for 'update' and other for 'cancel'. whenever the user press the either buttons there is no problem as Database transactions are maintained and window will be closed. But when the user close the popup by pressing X button of the window(it is usual practice in windows environment. we cannot force the user to use buttons only), the database is locked as there will no action perform to release database lock.

Any idea?

Thanks in advance,
Prasad
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look into modal window. You could set up the onbeforeunload. Look at this: http://www.eggheadcafe.com/articles/20010406.asp

Eric
 
Prasad Babu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Thank you for reply. Really very nice idea. Its working fine in my case.

Thanks a lot.

With regards,
Prasad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic