Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Wait the end of a JS DA before to do next action

Alexis BJan 15 2024

Hi All

I am using APEX 20.2

On a button with a dynamic action “On Click” with 2 actions

First one is a javascript action asking a first Confirmation Message
And if user press No, it show a second Confirmation Message :

apex.message.confirm("Do you want to see Outstanding SKUs ?", function(ok) {
if (ok) {
$s("P11_OS_TYPE", "E");
$s("P11_OLD_INIT", $v("P11_INIT"));
} else {
apex.message.confirm("CAUTION : You have NOT SAVED the data ! Press \"Yes\" to exit or press \"No\" to return to Save Screen.", function(ok) {
if (ok) {
apex.navigation.dialog.close(true);
} else {
apex.da.cancelEvent.call(this);
}
});
}
});

Second action is a submit page that should only occurs if user press OK to the first confirmation message

My issue is that confirm message is shown and submit is directly launched just after.
I didn't have time to answer the confirm message

Why do my submit is launched even if first action is not finished?

In this case I amended my JS code to integrate the submit :

apex.message.confirm("Do you want to see Outstanding SKUs ?", function(ok) {
if (ok) {
$s("P11_OS_TYPE", "E");
$s("P11_OLD_INIT", $v("P11_INIT"));
**apex.page.submit( {**
**request: "SHOW_OS",**
**showWait: true,**
**} );**
} else {
apex.message.confirm("CAUTION : You have NOT SAVED the data ! Press \"Yes\" to exit or press \"No\" to return to Save Screen.", function(ok) {
if (ok) {
apex.navigation.dialog.close(true);
} else {
apex.da.cancelEvent.call(this);
}
});
}
});

And it works well

But I would like to undesrtand why my first try didn't worked

Thanks

Best regards,

This post has been answered by Karel Ekema on Jan 15 2024
Jump to Answer
Comments
Post Details
Added on Jan 15 2024
3 comments
675 views