Showing confirm dialog box while cancelling transaction using java script in ADF page.
Tuesday, February 10, 2009
We come across a situation where we need the user to confirm before cancelling a transaction or confirm before deleting a record. Following example show how to achieve that in ADF page using a java script.
Let us say user is in employee creation page and he wants to cancel and go back to home page. On clicking Cancel button, a java script dialog box appears to confirm the action.
Add the following java script to the Cancel button “Onclick” java script events attribute.
if (confirm('Do you want to cancel?')) {return true;}else {return false;}
If the user clicks OK then Cancel button’s action will be called else Cancel button’s action will be ignored.
Pretty simple……..