Prompting users to save changes to XPages

You can control how an XPage application prompts the user when the user requests an action that closes a page with modified fields.

About this task

When an XPage or custom control contains editable controls, you can set two properties to specify how the application prompts the user about modified controls. These properties exist on two levels, the XPage or custom control level and the core control level.
  • Level 1: XPage or custom control
    • enableModifiedFlag (boolean - default implicit value is false) – Specifies whether to prompt the user to save changes to core controls in the XPage or custom control, and whether to enable the Notes® client File > Save option when the XPage or control has been modified in the Notes client. Applications running in an external browser cannot use the Notes File > Save mechanism, so only the prompt dialog is displayed to the user.
    • modifiedMessage (string) – A custom message to display in the prompt dialog
  • Level 2: Core control
    • disableModifiedFlag (boolean - default implicit value is true) – Specifies whether to prompt the user to save changes to the core control
The enableModifiedFlag property takes absolute precedence when enabling or disabling modification notifications for a given XPage or Custom Control. If you set this property value to true, the user will be notified about changes to all supported Core Controls within the XPage or Custom Control, unless you explicitly set the Core Control disableModifiedFlag property value to true. If you do not set the enableModifiedFlag for an XPage or Custom Control, or you explicitly set the value to false, and you set one or more Core Control disableModifiedFlag property values to false, the user will not be notified about changes, because the enableModifiedFlag property takes precedence.
The following Core Controls support this feature:
  • Edit Box
  • Multiline Edit Box
  • List Box
  • Combo Box
  • Check Box
  • Radio Button
  • File Upload
  • Date Time Picker
  • Rich Text Editor

If the user chooses not to save modifications to the current page, the requested action (such as closing the page, or navigating away from it in a browser) can execute. If the user chooses to save modifications, the related fields are validated before the page is saved. The validation occurs first on the client and then on the server. Only when client-side validation of the current page fields is successful can server-side validation occur. If server-side validation fails, the user is presented with the current page containing the offending fields and given the opportunity to correct the field content. Once server-side validation succeeds, the requested action can execute.