I am writing an event handler for ContentService.Saving which checks the content of certain fields. If anything invalid is found, I am using "CancelOperation" to cancel the save and output a message to the user.
That part is working OK, however, I am not getting the "You have unsaved changes" message. I do get the message if I make a change and navigate away from the page without trying to save (and therefore triggering my validation code).
If I get my "invalid" message and then navigate away from the page, then all changes are lost.
The "You have unsaved changes" probably checks if you haven't pressed the save button. Since you did press the save button it's assuming that everything is saved even though you canceled saving in an event.
The "You have unsaved changes" message is probably some client side check and doesn't check anything server side.
No "You have unsaved changes" message
I am writing an event handler for ContentService.Saving which checks the content of certain fields. If anything invalid is found, I am using "CancelOperation" to cancel the save and output a message to the user.
That part is working OK, however, I am not getting the "You have unsaved changes" message. I do get the message if I make a change and navigate away from the page without trying to save (and therefore triggering my validation code).
If I get my "invalid" message and then navigate away from the page, then all changes are lost.
Hello,
The "You have unsaved changes" probably checks if you haven't pressed the save button. Since you did press the save button it's assuming that everything is saved even though you canceled saving in an event.
The "You have unsaved changes" message is probably some client side check and doesn't check anything server side.
Too be honest the "You have unsaved changes" message has more issues: http://issues.umbraco.org/issues/U4?q=discard+changes
Jeroen
is working on a reply...