Jump to main content Jump to doc navigation


Extends: Ext.Component Key Features: AJAX connector features.

The MODx.msg class provides the functionality of the Ext.MessageBox class, with the added benefit of using an AJAX callback function (for confirmation dialogs). Simply provide a URL and optional parameters and a connector request will be sent after the user confirms the prompt. It defaults to a minimum width of 200px.




Used to display an alert dialog box on the page. Example:

MODx.msg.alert('Warning!','You are out of space! We should clear the cache.',function() {



Loads a confirmation dialog that prompts the user for a Yes/No response. If Yes is selected, fires an AJAX request to a specific connector. The properties for the config parameter are:

Name Description
title The title of the confirmation box.
text The text in the confirmation box.
url The URL to send the AJAX request to.
params The REQUEST params to send with the AJAX request.
listeners Any listeners to look for on the request.

An example:

   title: 'Are you sure?',
   text: 'Do you want to delete the world? This is irreversible.',
   url: 'http://rest.endofdays.com/armageddon/',
   params: {
      deleteWorld: true
   listeners: {
        'success':{fn: function(r) {
             MODx.clearCache(); /* clear cache after world destruction, so we dont have latent data */

MODx.msg.confirm Custom Events

MODx.msg.confirm adds a few custom events that fire:

Name Description
success Fires on a successful response from the AJAX submission.
failure Fires on a failed response from the AJAX submission.
cancel Fires when the user cancels the confirmation dialog.



Loads a temporary status message in the top-right of the screen, that fades away. The properties for the opt parameter are:

Name Description Default
title Optional. The title of the message.
message The text of the status message.
dontHide If true, will not automatically hide the status message. Will stay until it is clicked. false
delay The number of seconds to show the message. 1.5

You could use this in custom manager pages to provide confirmation your object was saved. You could add something like this to your FormPanel definition:

        listeners: {
            'success': function (res) {
                    title: _('save_successful'),
                    message: res.result['message'],
                    delay: 3

The 'success' listener is part of modExt and comes with MODx.FormPanel.

See Also

  1. MODExt MODx Object
  2. MODExt Tutorials
    1. Ext JS Tutorial - Message Boxes
    2. Ext JS Tutorial - Ajax Include
    3. Ext JS Tutorial - Animation
    4. Ext JS Tutorial - Manipulating Nodes
    5. Ext JS Tutorial - Panels
    6. Ext JS Tutoral - Advanced Grid
    7. Ext JS Tutorial - Inside a CMP
  3. MODx.combo.ComboBox
  4. MODx.Console
  5. MODx.FormPanel
  6. MODx.grid.Grid
  7. MODx.grid.LocalGrid
  8. MODx.msg
  9. MODx.tree.Tree
  10. MODx.Window

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.



$0 per month—let's make that $500!

Learn more