cancel
Showing results for 
Search instead for 
Did you mean: 

Notifying user of unsaved changes during application exit

Former Member
0 Kudos

Hello Experts,

I was wondering, is there a way of notifying the end user of a web dynpro application of unsaved changes if they attempt to navigate to a different role, or workset or page? I currently implemented a popup in the wdDoExit() of the view controller, and also tried the same in component controller, but it doesnt seem to work.

Any guidance is appreciated.

Regards

MM

PS. Using version 7.0.19_patch 1 of NWDS

Portal Ep7.0 SPS 19

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marshall,

You can use Work protect mode offered by SAP for this purpose. It will open a popup automatically if you try to close the window or it will open a new page if you try to navigate to a new role or workset.

Also rather than having your own popup this will have only couple of lines of code and this will reduce the programming effort.

Regards,

Ponraj M

Former Member
0 Kudos

Hi,

Well, in here the code was already developed when I joined. Basically, we keep one version of the data in it's original state, and another version which the user can modify while working. Whenever he tries to navigate away, we compare both data to see if any attribute value has been changed. We use a confirmation dialog to save or discard the changes.

In order to have the wdDoExit being executed when you navigate away from the View, you need to change the view lifecycle to "when_visible". Correct me if I'm wrong.

Hope it helps,

Daniel

Former Member
0 Kudos

Hi Ponraj,

Is the work protect mode part of the NWDS api?

How would I implement it? Can you shed some light or point me in the right direction please.

Thanks.

Former Member
0 Kudos

Hi Daniel,

I kind of understand what you're saying but dont know what you mean by change the viewcycle.

Is there some sort of when_visible property somewhere? When does that get triggered?

How do we implement this?

Thanks

MM

Former Member
0 Kudos

Hi,

As already mentioned work protect mode is your answer. For more details look at [this|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a891e490-0201-0010-fb99-b7e4f5dda2ec]. You can also search this forum for work protect mode.

Regards,

Satyajit

Answers (1)

Answers (1)

former_member185086
Active Contributor
0 Kudos

Hi

I have one clue : Say when we make any field mandatory we can listen its state whether it filled or not ,before navigating to other view if we maintaine one boolean flag which tells us that any attempt is made to create something but before saving they trying to left the page based on this true /false value we popup a message saying about datalost or some information.

Now question is where we popup message : in save event only why (not in wddoexist()) : in this way we can maintaine three state

1. Saved : Created something and saved .

2.Unsaved : It activate when ever user press Create buton and try to move without saving.

3.partially filled : User press create event fill some data but not intended to save.

Infirst line I mentioned about field mandatory its optional but if we use then we have better control and in future its adaptable if required.

This is the case for view navigation .Plz Explain case for role and workset .

Best Regards

Satish Kumar

Former Member
0 Kudos

Hi Satish,

I'm not navigating between views within the application.

My issue is, while the user is working on some web dynpro app, and he accidently (or purposefully) navigates away from the application, say by clicking another tab (role) in the portal, how can we ensure he doesn't lose his work? Can we display a popup? For this i want to use the wdDoExit() method, but it doesn't allow me to perform any UI programming inside it, ie popup message box. I did notice that I can save the changes but without informing the user and also i dont want to save changes the user doesnt want to save!

MM