I have another way, but I'm not sure whether I'd say that it's more elegant.
Create a submit button "btnRealSubmit" with no script on it. Set its presence to "invisible". Make btnModify and btnSubmit normal command buttons. On the click event for these, you can write whatever script you want including presenting warning dialogs and so on. When you want to submit, call btnRealSubmit.execEvent("click");
Jared Langdon
www.jlangdon.ca