Today, I share with you a demoapp with a basic "has document been modified validation" (in lack of a better description) custom control, ccValidateModified.
Just pop it into an XPage with a document data source, and it should in theory work out of the box. Plug and play.
This is by no means an absolute protection against save conflicts. For applications that it's critical to avoid save conflicts, you need better protection.
Below is a movie of the control in action. A document is open in Opera, Firefox and Internet Explorer. When the document is saved in one of the browsers, the "other browsers" gets a dialog saying that the document has been modified.
(Click the play-icon to start. Broadband recommended.)
The way it works is that a scoped variable with the modified-time from the stored doc is set on page load (editmode).
When the window gets focus/every two seconds (setInterval), a partial refresh is initiated. If the doc has been modified since the document was opened for editing, a hidden image is loaded. The image has an onload event (easiest way to make it cross browser) -> show a modal dojo dialog.
>> Download demoapp with custom control
Share and enjoy!