!--a11y-->
Creating a Confirmation Dialog Box
You want a confirmation dialog box containing two pushbuttons to appear when Send Email is chosen. The OK pushbutton closes the window. The new email pushbutton deletes the content of the input form and closes the window.
The functions for sending the e-mail are not implemented. For more information, see the tutorial “Using an E-Mail Web Service”.

...
1. Open the EmailView controller (Web Dynpro Components à PopupComp à Views à EmailView).
2. Choose the Methods tab page.
3. Choose New. In the wizard that appears, select Event handler and choose Next to confirm.
4. Enter the name ok and choose Finish to confirm.
The Event Source is assigned
dynamically in the implementation.

5. Use the same procedure as in steps 3 to 4 to create the event handler newEmail.
...
1. Switch to the Implementation tab page.
2. To clear the input fields in the form, reset the corresponding context attributes.
Add the following program code to the method newEmail():
newEmail() |
public void newEmail(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin newEmail(ServerEvent) wdContext.currentEmailSettingsElement().setToAddress(""); wdContext.currentEmailSettingsElement().setFromAddress(""); wdContext.currentEmailSettingsElement().setMsgBody(""); wdContext.currentEmailSettingsElement().setASubject(""); //@@end } |
...
1. Add the following program code to the method onActionSendEmail():
onActionSendEmail() |
public void onActionSendMail(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionSendMail(ServerEvent) String dialogText= "The email was successfully sent!";
IWDConfirmationDialog dialog = wdThis.wdGetPopupCompController() .wdGetAPI().getWindowManager().createConfirmationWindow( dialogText, wdThis.wdGetAPI().getViewInfo().getViewController() .findInEventHandlers("ok"), "ok"); dialog.addChoice(wdThis.wdGetAPI().getViewInfo().getViewController() .findInEventHandlers("newEmail"), "new email"); dialog.open(); //@@end } |

You create the confirmation window in the window manager by using createConfirmationWindow(String text,IWDEventHandlerInfo eventhandler,String buttonLabel). The event handler ok that you defined in the view controller is transferred as the event handler.
To add a second pushbutton to the confirmation window, use create(IWDEventHandlerInfo eventhandler, String buttonLabel). The event handler new email that you defined earlier is transferred as the event handler.
Next
step:Executing the Application TutWD_Popup_Init
