Prevent users to accidently navigate away and lose data – GWT/SmartGWT

Just add to the panel. A very useful code.

//Added the code to prevent the users navigating away.
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
closingEvent.setMessage(”Do you really want to leave the page?”);
}
});

//Added the code to prevent the users navigating away.

Window.addWindowClosingHandler(new Window.ClosingHandler() {

public void onWindowClosing(Window.ClosingEvent closingEvent) {

closingEvent.setMessage(”Do you really want to leave the page?”);

}

});

Comments are closed.