dominoGuru.com
Your Development & Design Resource
NotesDocument Auto-Save Online Demo
08/28/2009 02:43 PM by Chris Toohey
For those of you who don't follow me on twitter or are one of connections on facebook, you may have missed my call to test out my NotesDocument Auto-Save Online Demo:
While I'm taking the family to Go-Karts, check out my Online Domino NotesDocument AutoSave Demo @ http://bit.ly/BfEfv (just play nicely)!
Those beta testers (thanks gang!) confirmed that it's working like a charm... but I wanted to broaden the test group (as well as give you a live demo of a fairly basic but pretty slick Auto-Save feature that you can easily add into your existing Domino Web Applications.
The concept is pretty basic: When enabled on a new NotesDocument, the Auto-Save is triggered every 5 seconds. The Auto-Save submits the uidoc (go with me here...) via an AJAX-based HTTP Post - if it hasn't been saved yet, it submits to temp?CreateDocument, otherwise it submits to 0/<NotesDocument Unique ID>?SaveDocument. Post-submission, the AJAX POST returns the submitted NotesDocument Unique ID to a field on the HTML Form element named UNID (and that's you-nid btw...).
When you actually attempt to submit the HTML Form, it checks the UNID HTML field. If it's blank, it submits to document?CreateDocument, otherwise it submits to documents/<Value of the UNID HTML Field>?SaveDocument. (There's a Form Formula on the documents View Design Element that handles the submission. Same goes for the Auto-Save; it first checks the UNID before it submits - hence the @IsNewDoc-like functionality.
The reason why I went with this approach will be clear once the article is published... which will be soon after I return from vacation. Said article, and the downloadable example NotesDatabase, will be available on the Lotus Domino Designer Wiki.