Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

On creating a confirmation dialog getting null ptr error

Hi Forum

I needed a confirmation dialog i have created two event handlers ie delUserConfirmation_ok and delUserConfirmation_cancel in the controller of my project. Then on the Click event of my delete button in the view I want the confirmation dialog box to appear. So for this I have written the following code:

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

String dialogText = "Do you want to delete the user";

IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,controllerInfo.findInEventHandlers("delUserConfirmation_ok"),"ok");

dialog.addChoice(controllerInfo.findInEventHandlers("delUserConfirmation_cancel"), "cancel");

dialog.open();

but on clickin the delete button I am getting null pointr error.Also is it possible to hv a click event ie action for the ok button of my dialog box.

Thanks&Regards

Jaspreet Kaur

Former Member
Former Member replied

Hi Jaspreet,

Just open up the view and select the Method tab and see that you have event handler named delUserConfirmation_ok and delUserConfirmation_cancel and if you don't have then you need to create.

IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,controllerInfo.findInEventHandlers("<b>delUserConfirmation_ok</b>"),"ok");

dialog.addChoice(controllerInfo.findInEventHandlers("<b>delUserConfirmation_cancel</b>"), "cancel");

Also, confirm that the name is exactly the same that you provided while creating event handlers.(Keep case sensitivity in mind).

Regards,

Murtuza

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question