I've a page process that I wish to trigger to delete an order if a user has removed all items from said order while modifying it. I would like to implement a javascript pop up to notify them that if they continue, their order will be deleted and if they acknowledge yes, redirect them to page 4.
What I'm doing is not quite working. I get the pop up, but the calling page "disappears" (browser screen is blank save for the confirm box) and if the user answers yes, the redirect does not work. If they answer no, the order is deleted anyway.
How do I preserve the view of the calling page?
How do I fix the redirect?
How might I exit the script from within the HTP.p javascript?
Thanks!
Paul
declare
counter number := 0;
begin
select count(*) into counter
from SM_INVENTORY_ORDER
where ORDER_ID = :F111_MODIFYING_ORDER;
if counter = 0
then
HTP.p ('<script type="text/javascript">');
HTP.p ('if (confirm("Confirmation Message")) redirect(''f?p=&APP_ID.:4:&APP_SESSION.'');');
HTP.p ('</script>');
delete from SM_ORDER
where ORDER_ID = :F111_MODIFYING_ORDER;
:F111_MODIFYING_ORDER := null;
end if;
end;