pkp/pkp-lib — comment on commit 50620d60a4c9e9563e9dd85f79150640115e1f22
File: js/controllers/form/FormHandler.js line 60
By jnugent:

Hey Bruno,

I had an idea last night that may work better if this is possible. I like the idea of using the SiteHandler to deal with these issues -- if we remove the code from FormHandler specifically, then subclasses of FormHandler do not necessarily need to care if form data has changed. If they are concerned with it, they can provide handlers to deal with it. Other instances like file downloads or Alec's new DropdownFormHandler need not care.

My question is this -- is it possible for your Notification system to block the beforeunload event? Can we trigger a notifyUser event in SiteHandler if there is unsaved data? Instead of displaying a JavaScript window as it currently does, it would be nice to be able to tie into the work you have already done on this. Could the redirectToUrl method in SiteHandler be useful here? Would it be possible to check and see if there is unsaved data, display the notification and then return false instead of navigating away from the page?