When your form is dirty and the user hits the back button your History.addValueChangeHandler is called. Then you show the Window.confirm() message and when the user hits NO, you simply do not react and stay on your current place inside your app. Of course your URL hash fragment is wrong now as the browser has changed it automatically (you can't do anything against it, even not in the HistoryImpl classes).
You could correct the wrong hash fragment by calling History.forward() and do nothing on the resulting History.addValueChangeHandler call as you have not changed your place in your app. So you need to remember where you are and you have to remember that independently of what the URL hash fragment looks like. I do something similar with GWT Places. When a user is at Place1 and manually changes the URL hash fragment to something that represents Place2 the app would go to Place2. But if the user does not have the permission to access Place2 the app will not go there and stay at Place1. Instead it will show a Window.alert() message and after that it calls History.back() to change the hash fragment back to what it was before the user has modified it manually. As the application is still at Place1 and History.back() would go back to Place1 nothing will happen. This works pretty well and is done using a custom PlaceController. -- J. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
