Reputation: 1006
I like to create an XPage which have the same usability in the save behavior like a notes document, special I like to realize the SaveOptions
behavior 'When the User change something, the system remember him to save and if the user save, the system to not remember him'.
I found out a 50% solution, over the data->enableModifiedFlag property the system recognized if the user change something in the document and if so post the string that is stored in the data->ModifiedMessage property.
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" enableModifiedFlag="true">
<xp:this.modifiedMessage><![CDATA["please Save"]]></xp:this.modifiedMessage>
</xp:view>
But if I save the Document in the datasource and like to leave the site, the post still occur.
How could I realize that when the XPages-Doc is different to the dataSourceDoc the post occur, and if the XPages-Doc is equal to the dataSourceDoc, the Post not occur?
Upvotes: 1
Views: 353
Reputation: 15729
enableModifiedFlag allows you to refine the functionality.
Custom Controls also have an enableModifiedFlag, which should allow you to give a message only if something in that custom control has changed.
Individual input controls have a disableModifiedFlag that can be set to true, to ensure that particular control is ignored when identifying if the page has been modified or not.
A Button of type "Cancel" will ignore enableModified and just move on.
You can also programmatically set or clear the modified flag in CSJS (XSP._setDirty(false,""). There is also a view.setEnableModifiedFlag(boolean) method that can be used to change the enableModifiedFlag property on an XPage from SSJS.
Panels don't have an enableModifiedFlag or disableModifiedFlag property, but with the options I mentioned it should give you the control you need.
Upvotes: 4