I'm currently using oracle apex. I created a wizard progress list for my page with the labels in the list as navigable links. But when the user clicks on these links to navigate to another page i need to ask the user if he's sure as there are unsaved changes, probably using apex.message.confirm()
. I made it navigable by using href="my_link"
in the list entry label while creating list in shared components. I know if i add onClick="my_function();"
i can direct add functionality to that link.But where to add this javascript function at the application level? How do i do that? any ideas?
Note : I cant use warn on unsaved changes option at the page level. Because iam submitting the values in my page to the db through dynamic action(pl/sql code). So even after clicking on save and inserting data into DB, when i try to navigate to other page it will show warning on unsaved changes. I cant use submit page on click of save button as it is refreshing the whole page and it is not desired.
Page properties -> Navigation
-> Warn on Unsaved Changes
set to Yes
. After that it will work automatically. Works in APEX 5.
To cancel checks of unsaved changes, use JavaScript function apex.page.cancelWarnOnUnsavedChanges();
. For example, if you save data with the DynamicAction, add additional true action with type Execute JavaScript Code
and call it there.
By using onClick ="my_function();"
in the name provided while filling in the list entry label in the shared components for list , you can define what needs to be done when clicked on the link. "my_function"
can then be declared at the page level in the function and global variable declaration
section. For example:
<a href="#" onClick="my_function('28');">&F300_LABEL_TEXT.</a>
will be the list entry label at the shared components! and in the function and global variable declaration
section at the page level.
function my_function(page){
if (apex.page.isChanged() == true)
{apex.message.alert("there are unsaved changes");
else{apex.navigation.redirect("f?p="+$v('pFlowId')+":"+page+":"+$v("pInstance")+"::NO");}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.