Here is an interim solution using javascript.
As written, it requires the "prototype" framework
(http://www.prototypejs.org/), but can be re-written to work without it.
//
// submitting/leaving this screen (beforeUnload event)
//
function changesWillBeLostWarningHandler(e) {
e.returnValue = "If you have not saved your changes, they will be
lost.";
return false;
}
Event.observe(window, 'load', function() {
Event.observe(window, 'beforeunload',
changesWillBeLostWarningHandler);
});
Event.observe(window, 'load', function() {
// bug patch to myFaces JSF where beforeunload doesn't
work correctly with oamSubmitForm method
if(oamSubmitForm !== undefined && oamSubmitForm instanceof
Function) {
// retain original version of the oamSubmitForm
function
originalOamSubmitForm = oamSubmitForm;
// wrap the original version of the oamSubmitForm
function with a try catch block
oamSubmitForm = function() {
try {
// calling oamSubmitForm(formName,
linkId, target, params)
originalOamSubmitForm.apply(this,
arguments);
} catch(e) {
// ignore exception when CANCEL
button is clicked
}
}
}
});