URIFragmentUtility change event Vs ValueChange event


I made a tool to develop around vaadin and pages mecanism.
It uses UriFragmentUtility.

One of the stuff is to validate the current page (if the page implements Validatable interface) when the user leave the current page using browser history back or forward.
If validate method throws an exception, i stay on the same page and i print a warning.
In most of the cases, it works but sometimes it doesn’t.

Thus, here are my tests to explain the problem :

  • I have a page that implements Validatable. In the validate method, i validate an email field

  • My email field has his setImmediate value set to true.

  • I set my email with a good email value. I change my page. It works.

  • I go back to my page. I set the email value with a bad format. I click outside the field. An ajax call is sent and my field value is updated in server side.

  • I click on history back button. My validate method is called by my URIFragmentUtility management. An exception is thrown and i’m redirected to the current page with a warning.

  • I set my email with good value and i do once again the same test as before.

  • I set my my email with bad value but i don’t leave the field. No call is sent to the server.

  • I click on history:forward (or back, it does the same)
    ==> a first call is sent to the server in order to change URI fragment. At this time, the email field value is not yet updated in server side
    ==> My validate method is called but it validates the old email value ==> no exception is thrown
    ==> a second call is sent to the server in order to update email field but it is too late for validation.

Is there any way to change those requests order ?
Is it possible to send field changes in the same time the uri fragment change request is sent ?

Thanks for your help.

I’ve just created an issue in trac : http://dev.vaadin.com/ticket/7860