cancel
Showing results for 
Search instead for 
Did you mean: 

Display message when leaving WD View to save the entries

Former Member
0 Kudos

I have a Custom entry view. I want to display a message to save the changes the user has made, when user is leaving the page, by clicking a button on the page or by selecting another tab on the portal .

I tried to use WdDoExit of the view. It was not executed while leaving the view. I tried controllers WdDoExit. Even that was not executed.

Can anyone help how to acheive this functionality.

Regards

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

HI,

If you want to prompt user to save changes or not, Use Window

Create another window in the project, say newWindow

Create two EventHandlers, OK and CANCEL

In the action of Button, write the following code

IWDControllerInfo objinfo=wdControllerAPI.getViewInfo().getViewController();

String str1="You Want To Save Changes?";

IWDConfirmationDialog dialog1=wdComponentAPI.getWindowManager().createConfirmationWindow(str1,objinfo.findInEventHandlers("OK"),"OK");

dialog1.addChoice(objinfo.findInEventHandlers("CANCEL"),"CANCEL");

dialog1.open();

}

then in the EventHandler "OK" write your code to save changes

leave EventHadler "CANCEL"

Regards

LakshmiNarayana

Former Member
0 Kudos

Sorry I was not clear on my question. I should not have mentioned leaving the screen by clicking the button. With button I can do it in the action event.

I know how to create a pop up dialog box. What I am trying to understand is if the user accidentally navigates away from the screen, by clicking another top level tab on the portal or by clicking some other application view, I want to know which event I can write code to display the message. This applies when user is closing the browser, to raise an event before the browser is closed.

I tried the view's wdDoExit and controller's wdDoExit. Neither seem to execute the code I placed. I am not sure if wdDoExit is only executed under certain sequence.

Thanks

Raghu

Former Member
0 Kudos

Hi Ravi,

Have u tried this ??

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8382535d-0d01-0010-dbb5-d3d41dfefd10">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8382535d-0d01-0010-dbb5-d3d41dfefd10</a>

regards

Sumit

Former Member
0 Kudos

Hi Ravi,

Is ur problem solved??

regards

Sumit

Former Member
0 Kudos

Sumit,

The article you suggested defintely helped me.

I still have some small issues implementing the workprotect mode. I am trying to figure out what is an easy way to mark a page dirty. I have about 70 fileds on the form.

I will mark the question answered and post another one if there are any questions. Thanks for your help

Former Member
0 Kudos

Hi Sumit,

is it possible to save the view content without sap portal ?

I've implemented a savedocument - routine in wdDoExit of the controller and view but in both the context ist not filled when I click on close browser - button.

Regards,

Viktor.

Former Member
0 Kudos

HI,

If you want to prompt user to save changes or not, Use Window

Create another window in the project, say newWindow

Create two EventHandlers, OK and CANCEL

In the action of Button, write the following code

IWDControllerInfo objinfo=wdControllerAPI.getViewInfo().getViewController();

String str1="You Want To Save Changes?";

IWDConfirmationDialog dialog1=wdComponentAPI.getWindowManager().createConfirmationWindow(str1,objinfo.findInEventHandlers("OK"),"OK");

dialog1.addChoice(objinfo.findInEventHandlers("CANCEL"),"CANCEL");

dialog1.open();

}

then in the EventHandler "OK" write your code to save changes

leave EventHadler "CANCEL"

Regards

LakshmiNarayana

Former Member
0 Kudos

Hi Ravi,

You can try in wdDoModifyView().

In few situations it will work. And display the error message by using raiseException method, set the navigation as false in that method..

Regards,

Kiran Chennapai

former_member485701
Active Participant
0 Kudos

Hi Ravi,

In the action of your button in the view, write the following line

wdComponentAPI.getMessageManager().reportSuccess("User data saved");

It will print the message, do not need to write in wdDoExit() of view.

Regards,

Praveen

Former Member
0 Kudos

Hi Ravi,

Find the tutorial for ur requirement.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8382535d-0d01-0010-dbb5-d3d41dfefd10">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8382535d-0d01-0010-dbb5-d3d41dfefd10</a>

regards

Sumit

former_member214651
Active Contributor
0 Kudos

Hi Ravi,

Try writing the message on the Action of the Button / Tab.

Regards

Poojith MV