asktosavework Ask to user if he want to exit before save his work using onbeforeunload event

  1. Requirements
  2. Usage
  3. Resources

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)

Requirements

jQuery (1.x) Yii 1.1 or above Tested in (IE9, Chrome and Firefox), not tested in IE8 or IE7

Usage

Save the file "AskToSaveWork" in /protected/extensions and just put the widget in any _form, wherever you want:

<?php $this->widget('ext.AskToSaveWork', array('watchElement'=>'#Product_name','message'=>Yii::t('messages', "You haven't save your product yet!")))?>

Resources

5 0
9 followers
405 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: aleksdj
Created on: Apr 7, 2012
Last updated: 12 years ago

Downloads

show all

Related Extensions