[原][Code Sample]Alert "Do you want to save the changes you have made?"

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;



作者:pan_tian 发表于2012-4-10 13:32:19 原文链接
阅读:12 评论:0 查看评论


Link URL: http://blog.csdn.net/pan_tian/article/details/7444991
请使用浏览器的分享功能分享到微信等