Jump to content

Adding "have you saved?" dialog when leaving BO product editing page


mkweb09

Recommended Posts

I'm looking to add a dialog box which pops up when you closed the Product Details page in the back office. This is to prevent employees from accidentally exiting a page without saving changes.
(The code doesn't check for saved or changed info, just reminds you to save!)

 

I have the code, but have no idea where to add it to make it work. Where in the FTP can i find the right page?

 

This is the code:

 

<script>
function goodbye(e) {
    if(!e) e = window.event;
    //e.cancelBubble is supported by IE - this will kill the bubbling process.
    e.cancelBubble = true;
    e.returnValue = 'Please SAVE before leaving this page'; //This is displayed on the dialog

    //e.stopPropagation works in Firefox.
    if (e.stopPropagation) {
        e.stopPropagation();
        e.preventDefault();
    }
}
window.onbeforeunload=goodbye;
</script>

 

Thanks.

Mark

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...