1: When exiting form, Check the form status.
2: If the status is changed, then display the customized alert.
in a KEY-EXIT trigger at form level, enter the following code:
declare
button_val number;
begin
-- Perform validation at item level to update :SYSTEM.FORM_STATUS.
validate(ITEM_SCOPE);
-- Check the record status
if(:SYSTEM.FORM_STATUS = 'CHANGED') then
button_val := show_alert('ask_commit');
if button_val = ALERT_BUTTON1 then
-- If user chooses to commit changes...
commit_form;
exit_form;
elsif button_val = ALERT_BUTTON2 then
-- Do nothing if user cancels...
null;
elsif button_val = ALERT_BUTTON3 then
-- Exit without committing...
Exit_form(No_commit);
end if;
else
-- There have been no changes, just exit...
exit_form;
end if;
end;