Display a question to the user with an "Okay" or "Cancel" response and a callback to respond to the result.

Description

CONFIRM displays a message to the user and allows a callback function that will be invoked to respond to the result of the question.

304

Confirm

Parameters

title String (required) - A short title for the alert

message String (required) - The message content for the alert

callback function (required) - invoked when the message box is dismissed

Examples

Basic example.

CONFIRM('Confirm', 'You have selected a critical safety violation. Are you sure?', function (result) {
  if (result.value === 'Okay') {
    // Selected Okay
  } else {
    // Selected Cancel
  }
});

Example seen in GIF animation.

ON('change', 'violations_observed', function(event) {
  if (CHOICEVALUE($violations_observed) == 'Critical violation(s)') {
    CONFIRM('Confirm', 'You have selected a critical safety violation. Are you sure?', function(result) {
      if (result.value === 'Cancel') {
        SETVALUE('violations_observed', null);
      }
    });
  }
});