This is an updated technique from my previous download "Modal Windows/Revert Record" (see below). That technique used a hidden button in the background. This updated version is a cleaner approach, using the OnRecordCommit and two scripts.
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". 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. Ernest's comments regarding this technique start at 42:48FMP 12 File