20220103 - 확인 메세지 창 띄우기 (Confirmation Message)

1. 계획과 문제

배송출발 버튼 클릭시 PL/SQL로 상태값 업데이트 전에 Javascript에서 확인 메세지 이후 처리 여부를 진행, 하지만 Confirm 확인 메세지를 기다려주지 않고 PL/SQL까지 모두 실행되어버리는 문제 발생



Execute JavaScript Code


apex.message.confirm("'배송출발' 하시겠습니까?", function( okPressed ) { 
if( okPressed ) {
   return true;
} else {
   return false;
}
});


Execute Server-side Code


begin
  update po_mst 
     set proc_type = '71' 
   where nvl2(po_odgrp_id, po_odgrp_id, nvl2(po_grp_id, po_grp_id, po_id)) = nvl2(po_odgrp_id, :P62_PO_ODGRP_ID, nvl2(po_grp_id, :P62_PO_GRP_ID, :P62_PO_ID));
end;


2. 대안 - 조금 덜 이쁘지만 apex.message.confirm 대신 기본 confirm 사용


return confirm("'배송출발'하시겠습니까?");

이렇게 하면 이후 PL/SQL 자동 실행을 제어할 수 있음.





참고

https://doyensys.com/blogs/adding-dialog-confirmation-alert-in-oracle-apex-using-javascript/

https://www.traust.com/oracle-apex-js-confirm-and-pl-sql-dynamic-action/


댓글 없음:

댓글 쓰기

20250202 - IG 다운로드 버튼 바로 보이기

JS initialization Code : function (config) {     var $ = apex.jQuery,         toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),  ...