It will not work, because in some cases, event handlers of OK buttons implement logic that returns to a different overlay than the main page.