Nav view search

Navigation

Search

Knowledge Base

Technical tips, helpful recommendations, pointers and fixes.

Back

MetaScript Example - Using the Confirm function to Provide a Method For Cancelling an Action

2009-06-18

Bookmark and Share Share

This article provides an example for using the MetaScript Confirm function which can be used to allow users to confirm or cancel their scripted actions.

INFORMATION


In some situations, you would like to be able to cancel an operation you have started with a button. For example, you may have a script that copies information from one record to another. When users incorrectly click any button tied to a script that performs automated actions, you run the risk of invalid information being in your database. 

Use the confirm method to ask the user to make a decision that requires either an OK or a Cancel. The message argument specifies a message that prompts the user for the decision. The confirm method returns true if the user chooses OK and false if the user chooses Cancel.

if(confirm("Are you sure you wish to copy these jobs?")){  
    // Continue with the operations  
}  
else {  
    // The user clicked on "Cancel"