View Full Version : Using ExtJs in Page unload

18 Jun 2010, 3:22 AM
I have a scenario where the user is filling a form and clicks on a link (or something) else on the page to move away from the page. I want to ask him/her where they wish to save the form before moving on and if they click YES, then the form must be saved. If there are any errors they must be reported else on a successful save, the user must just continue to wherever he/she wanted to go. I wrote the following :

Ext.EventManager.on(window, 'unload', function() {
if (formIsUnsaved)
if (confirm('You have unsaved time entries, click OK to save, CANCEL to continue with your action'))


The problem is that the form is not submitted at all! And even if it was submitted, I would have to 'wait' for the completion and only on success return from the function. I am looking for suggestions on solving the problem.

Any help will be appreciated.