In APEX 24.2, adding a confirmation dialog with OK and Cancel buttons is straightforward using the Require Confirmation option.
You can also achieve this with a custom JavaScript implementation — a well-documented approach. The following code displays the confirmation dialog only when the approve message item contains a value:
var msg = $v("P687_APPROVE_MESSAGE"); // get message text
if (msg) {
// If there is a message, show confirmation dialog
apex.message.confirm(msg, function(okPressed) {
// Store the user’s response
$s("P687_ANSWER", okPressed ? "YES" : "NO");
// Always execute SAVE after the response
apex.submit("SAVE");
});
} else {
// If no message, just continue and mark answer as N/A
$s("P687_ANSWER", "NONE");
apex.submit("SAVE");
}
I need to implement a confirmation dialog with three options:
- Cancel: Returns to the edit form
- No: Submits the page and sets
P687_ANSWER
to NO
- Yes: Submits the page and sets
P687_ANSWER
to YES
Has anyone implemented something similar before?
Alternatively, I’m considering adding a select item to the form that requires the user to make a choice directly, eliminating the need for a confirmation dialog.
Thanks!