and so DialogBox can't return the modified document; it just saves its changes to the document highlighted in the view, leaving you with an in-memory document which is out of date. Fortunately, since you haven't changed it, your attempt to save changes does nothing.
Pass doc as an argument, and it will work more the way you expect. Oh, any why no Cancel button?
Feedback response number AGUD8TQQNV created by Andre Guirard on 04/26/2012