This simple extension ask to user if he want to exit before save his work using onbeforeunload event. It's the same behavior as Facebook when you are editing your status.
The extension disable the message only when you submit a form with submit type button, otherwise it shows the message.
You can optionally use an input element (ex. #Page_title, .Page_description) to watch. This way we can know if user is actually editing or not (avoiding unnecesary messages)
jQuery (1.x) Yii 1.1 or above Tested in (IE9, Chrome and Firefox), not tested in IE8 or IE7
Save the file "AskToSaveWork" in /protected/extensions and just put the widget in any _form, wherever you want:
$this->widget('ext.AskToSaveWork', array('watchElement'=>'#Product_name','message'=>Yii::t('messages', "You haven't save your product yet!")))