Sunday 6 January 2013

Triggering an UnCommitted/Not Saved Data Warning While closing and Navigating a Page

In general, if you are modifying some data on the page then you worked other activities then you are trying to close, if it is closed without showing any warning then we need to lose all our data. Here we are stopping if it contains any uncommitted data.

The property of 'uncommittedDataWarning' under the <af:document> is going to be used for showing the UnCommitted Data Warning While closing and Navigating a Page.

<af:document>
The document component creates each of the standard root elements of an HTML page: <html>, <body>, and <head>, but by abstracting away from those components, can be used in non-HTML pages as well.

The below points need to be consider while using,

  • Only one document component per page is allowed.
  • Documents must not be placed inside of page templates.

The property of 'uncommittedDataWarning', specifies whether users should be warned about uncommitted data when navigating off the page or region. Setting this property to 'on' will enable the warnings. It is not supported on the 'org.apache.myfaces.trinidad.core' renderkits.



For more details check with sample.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R2 Update3]

How to run this sample?
Run using the UnCommittedDataWarning.jspx and check the behaviors by typing some values in the Name field and press the F5, it will show the uncommitted data warning message.

No comments:

Post a Comment