Hi!
I want to warn on unsaved changes when item = EDIT, I use the same page for reading and editing. I have an item which contains EDIT or READ_ONLY. I want to warn only when item = EDIT and when the user wants to close the tab. 🙂
Thanks in advance!
Select Item. Go to Advance ->Warn on Unsaved Changes->Select Page Default
Hi Shimul!
It works only when I write something in the item and then trying to leave the page.
Works for Chrome and Firefox, thanks a lot Vinish! 🙂
Hi Pavlos,
Put the below JavaScript function in the page’s function and global variable declare section:
Change P18_TYPE with your page item.
Also, you can return any message from the function, but it shows only the default message in Chrome.
Please try and let me know if it works.
Works for chrome. Function returns warn when I click on the SAVE button, how to avoid this?
I have applied this and it works.
Let see, follow these steps:
Create one more hidden item Px_SAVE and set the default value type Static and value as N.
On the save button. Create a dynamic action to execute the JavaScript code and add the following code in it:
Now click on the Save button and you will find its action type to Dynamic Action, revert it to the Submit page.
And now change the main JavaScript function as below:
Please test and let me know if still any issues.