Wednesday, November 10, 2010

Jquery - Modal Delete Confirmation Dialog

First of all make sure you have jquery installed on your Apex environment.
If you do have it, lets do our tricks. There are two ways of doing it and I'll show both of them. The first option is to enable modal delete confirmation dialog on you "0" page so it will apply to all your pages automatically, and the second way is to manually add script to every page or to any page where you want this dialog to be.
OK, lets do Option 1:
- a. In your application create a page with number "0", in this page create a HTML region with No Template.
- b. Into the region source paste this:


- c. Ensure, that every page where you want to have a delete modal popup confirmation has this script in page HTML Header:



and your button (most likely it will be buton called DELETE) on your page which will call modal popup confirmation has URL Redirect to:

javascript:confirmDelete(htmldb_delete_message,'DELETE');

Try it, it should work.

OK, lets do Option 2:
- a. Into page HTML Header of the page where you want this modal confirmation to work insert this script:

This item will be permanently deleted and cannot be recovered. Are you sure?
- b. Assuming that you do have a Delete button on this page which does SQL Delete Action, use this Target URL to call the delete procedure:
javascript:confDialog()

That is it, you should be good now.
P.S. Thanks a lot to Jari Laine (Jarola) from  Oracle Apex Forum  for helping me to make it work.

No comments:

Post a Comment