Display an Are You Sure? Warning Message

In some cases, you may want to prompt the user to confirm that he or she really wants to continue before performing an action. For example, say the application includes a button to change the status of the document or to send an email. This routine illustrates how to prompt the user with a message such as "Are you sure?" before continuing with the transaction.

How It Works

The @Prompt function can be used to return a trUE or FALSE value. When combined with the @IF statement, you can determine what action (if any) should be taken based on the user's response to the question.

Implementation

To implement this solution, create an action button on a form, view, or page. Insert the following code. Replace the @Prompt statements with commands to be issued based on the Yes or No response (see Figure 14.19). For example, if the user selects Yes, issue the @MailSend command.

result := @Prompt([YesNo]; "Continue?"; "Do you want to continue?"); @If (result = @True; @Prompt([Ok]; "Result"; "You selected YES."); @Prompt([Ok]; "Result"; "You selected NO."));

Figure 14.19. Example "Do you want to continue?" prompt

Note

A similar implementation can also be achieved using LotusScript. Refer to Chapter 13 for additional information pertaining to this subject.

Категории