Jun 03

If you didn’t already know, its easy to override javascript alerts and functions with your own code. This post is focused on showing you how to easily implement an Ext message box to replace the “confirmDelete” and the “window.alert” functions.

Amazingly it takes very little code to achieve some nice affects:

/* Override the APEX delete operation message prompt */
function confirmDelete(pMessage,pRequest) {
    Ext.MessageBox.confirm('Confirm', pMessage, function (btn) { if (btn == 'yes') doSubmit(pRequest); });
}
/* Override the default alert javascript message box */
if(document.getElementById) {
        window.alert = function(txt) {
                Ext.MessageBox.alert('Alert', txt, null);
        }
}

Note: you just need to ensure that these are placed somewhere on the page before your code calls them, preferably in your page header.

Delete Prompt Example:
APEX ExtJS - Delete Prompt

Window Alert Example:
APEX ExtJS - Messae Alert

preload preload preload