Avoid popup you have unsaved changes

I have a screen with some dropdowns and an upload button. Once upload is success i am clearing all the fields and when i click on any other menu popup shows as there is unsaved changes

In same screen close button i handled it with close(StandardOutcome.DISCARD); in closeclick event

But clicking anywhere outside how can i avoid this popup.
So basically i need to clear all the changes that i made to the form after succesfull file upload and if fileuplad is error then popup can be shown

Override the hasUnsavedChanges() method in your edit screen:

@Override
public boolean hasUnsavedChanges() {
    return false; // super.hasUnsavedChanges();
}

See the super method to figure out how it works by default.

3 Likes

Thanks @krivopustov It works