DP: checking changes before leaving the page