This is an updated technique from my previous download "Modal Windows/Revert Record" (youtu.be/QTCqzysiQWA). That technique used a hidden button in the background. This updated version is a cleaner approach, using the OnRecordCommit and two scripts.
You can download this file at newleafdata.com/downloads-fmp.html
Giving credit where credit is due: The basis of this file/technique is from Artie Brosius' blog post "Easy FileMaker modal edit dialogs with full rollback support" (soliantconsulting.com/blog/2012/08/easy-filemaker-modal-edit-dialogs-full-rollback-support). Artie's technique is in FMP 11 which didn't have modal windows. Also, Ernest Koe of Proof Group demonstrated this technique during his DevCon 2013 presentation: "Great Interface Design Patterns for FileMaker Pro". You can download that talk from Tech Net (fmdev.filemaker.com/docs/DOC-3653). Ernest's comments regarding this technique start at 42:48