Setting Alerts and their buttons

camposaa
camposaa used Ask the Experts™
on
I have created an alert when a user deletes a record, they are prompted with a stop alert.  The default buttons are 'OK' and 'Cancel', but when you click either button, it just closes the alert and the delete still goes through.  Is there a quick line of code that will revert that delete, how can you control what the 'OK' and the 'Cancel' button does, any ideas?

I used the SET_ALERT_PROPERTY.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
OK and Cancel buttons do NOTHING at all. This is just an alert. You have to take actions manually.
If you have an alert called "DELETE_ALERT" with two buttons - OK and Cancel and a message of type "Are you sure you want to delete ....?" then the solution is this:

Let's say the user has clicked a button that will delete dome data. The code in the WHEN-BUTTON-PRESSED trigger must be:

declare
  btn_code NUMBER;
begin
  btn_code := Show_Alert('DELETE_ALERT');
  if btn_code = ALERT_BUTTON1 then
    ... Place delete code here
  else
    ... Don't delete anything
  end if;
end;

ALERT_BUTTON1, ALERT_BUTTON2 and ALERT_BUTTON3 are pre-defined constants in Forms and by comparing the return result of Show_Alert with them you may decide on which button has been selected by user.

Best, Kiril

Author

Commented:
That worked when I created an additional canvas/window...couldn't get it to work with an alert.

Author

Commented:
That worked when I created an additional canvas/window but I could not get that to work with an alert.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial