I'd like to know how to prevent a form from saving if a condition is true after a user presses the commit key (F10). I have tried adding this on-commit trigger at the form level but the form gets commited.
Code:
declare
update_after_approval exception;
err_txt VARCHAR2(80) := 'Document is already approved, cannot modify/delete';
al_id Alert;
al_button Number;
begin
if :LNAH_APPR_DT is not null then
-- record already approved
-- alert user
-- prevent update
al_id := Find_Alert('stop');
Set_Alert_Property(al_id, alert_message_text, err_txt );
al_button := Show_Alert( al_id );
--rollback;
else
commit_form;
end if ;
end;