Discussions
Categories
- 196.7K All Categories
- 2.2K Data
- 235 Big Data Appliance
- 1.9K Data Science
- 449.8K Databases
- 221.5K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 549 MySQL Community Space
- 477 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 532 SQLcl
- 4K SQL Developer Data Modeler
- 186.8K SQL & PL/SQL
- 21.3K SQL Developer
- 295.4K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.1K Development Tools
- 104 DevOps
- 3.1K QA/Testing
- 645.9K Java
- 27 Java Learning Subscription
- 37K Database Connectivity
- 153 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 17 Java Essentials
- 158 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 203 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 393 LiveLabs
- 37 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.6K Other Languages
- 2.3K Chinese
- 170 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 230 Portuguese
How to Bypass Message :This page is asking you to confirm that you want to leave?

Hi,
I have a page where I select a record from Interactive grid. There is a button in that region which has Dynamic Action. The DA has javascript which calls a process to prepare url (apex_util.prepare_url(apex_application.g_x01)
I am doing all this so that I can dynamically go to a specific page based on some logic. The page number is evaluated based on this logic.
All this works, however, I need to get rid of the warning pop up "This page is asking you to confirm that you want to leave......".
I have already set off the "Warn on unsaved changes" flag. Other than the IG, I have search field variables, which also have the "Warn on unsaved changes" set to ignore.
Is there a way I could get rid of the warning message?
Thank you in advance.
Prakash
Best Answer
-
So, your block is always putting "No Changes to Cancel." In this case, you are calling apex.page.warnOnUnsavedChanges, i.e. do warn. Of course, then, you get the warning. So, apex.page.isChanged() isn't doing what you expect. Placing the command to turn it off above this if block doesn't help you because, within the if block, you turn it back on.
Your original post was how to disable the warning. Get rid of the if block altogether and put in a call to apex.page.cancelWarnOnUnsavedChanges();. This should result in you no longer getting the warning and so; should satisfy as an answwer.
As to your isChanged call. I suspect you are saving the changes and then calling this block. In which case, the method will return false. It only returns true if it finds changes that have been made "since last being sent to the server".
-Joe
Answers
-
Hello PrakashC,
Call this JS function before redirect to remove the handler that checks for unsaved changes :
apex.page.cancelWarnOnUnsavedChanges();
-
Hi,
Thank you for responding. Sorry I missed to mention that I have already tried that & it is not helping to resolve the issue.
Here is a snapshot of my code, just in case I am going wrong somewhere
try {
var pg=2;
console.log('url check...');
apex.server.process("PREPARE_URL4TTS", {x01: urlstr}, {success : function(pData){
if (pData.success === true) {
if (apex.page.isChanged() == true) {
apex.page.cancelWarnOnUnsavedChanges();
} else {
console.log('No changes to cancel');
apex.page.warnOnUnsavedChanges("UnSavedChanges", fnIsChanged);
}
apex.navigation.redirect(pData.url);
} else {
console.log("inside false cond");
}
}, error: function(request,status,error){
console.log("status---"+status+" error----"+error);
}
}) ;
console.log('url check complete: ' );
} catch(e) {
console.log("Error: " + e);
}
My console.log always returns "No Changes to Cancel". I also just tried moving the "apex.page.cancelWarnOnUnsavedChanges();" above the if block, however, that did not seem to help either.
Thank you again for your response.
Prakash
-
So, your block is always putting "No Changes to Cancel." In this case, you are calling apex.page.warnOnUnsavedChanges, i.e. do warn. Of course, then, you get the warning. So, apex.page.isChanged() isn't doing what you expect. Placing the command to turn it off above this if block doesn't help you because, within the if block, you turn it back on.
Your original post was how to disable the warning. Get rid of the if block altogether and put in a call to apex.page.cancelWarnOnUnsavedChanges();. This should result in you no longer getting the warning and so; should satisfy as an answwer.
As to your isChanged call. I suspect you are saving the changes and then calling this block. In which case, the method will return false. It only returns true if it finds changes that have been made "since last being sent to the server".
-Joe
-
Thank you Joe,
commenting out the rest of the code did help.
try {
var pg=2;
console.log('url check...');
apex.server.process("PREPARE_URL4TTS", {x01: urlstr}, {success : function(pData){
if (pData.success === true) {
/*if (apex.page.isChanged() == true) {
apex.page.cancelWarnOnUnsavedChanges();
} else {
console.log('No changes to cancel');
apex.page.warnOnUnsavedChanges("UnSavedChanges", fnIsChanged);
}*/
apex.page.cancelWarnOnUnsavedChanges();
apex.navigation.redirect(pData.url);
/*} else {
console.log("inside false cond");*/
}
}, error: function(request,status,error){
console.log("status---"+status+" error----"+error);
}
}) ;
console.log('url check complete: ' );
} catch(e) {
console.log("Error: " + e);
}
Thank you once again.
Prakash