Jump to main content Jump to doc navigation

MODx.Window

Extends: Ext.Window Key Features: Drag-and-drop functionality; connector functionality for saving.

A MODx.Window edits record data from a Grid or AJAX request. It includes a FormPanel; add form fields (and other components) to it. Saving submits the FormPanel and sends an AJAX request to your connector.

Unique Parameters

Name Description Default
action If baseParams is not set, will use this as the action to the controller.
allowDrop Whether or not to allow dropping of tree items onto the form fields. 1
baseParams An object of parameters to send along with the window form on save. {}
blankValues If true, will reset the values of the form each time it is shown. 0
cancelBtnText The text of the cancel button for the window. Close (lexicon cancel)
fields An array of fields for the form, similar to Ext.form.FormPanel’s fields definition. []
fileUpload If true, the form will be built to accept files. 0
formFrame Whether or not to add a ext-style frame to the window. 1
labelAlign The alignment of the labels on the form. top
labelWidth The width, in pixels, of the labels on the form. 100
record A JSON object of default values (in name: value format) to set to the form when first loading the window. {}
saveBtnText The text of the save button for the window. Save
url The URL of the connector to submit the window form to.

Custom Events

Name Description
success If the form submission returns a success response.
failure If the form submission returns a failure response.
beforeSubmit Before the form submits its values to the connector, but after validation passes.
updateWindow After the window’s form values are updated from a record (setValues/reconfigure).

Unique Functionality

Firing the submit method

submit() submits the Window’s form. The window closes on success by default; pass false to keep it open:

var w = Ext.getCmp('my-window-id');
w.submit();      /* submit and close the window on success (default) */
w.submit(false); /* submit but leave the window open */

setValues

Sets the form values of the window:

var w = Ext.getCmp('my-window-id');
w.setValues({
  name: 'John'
  ,email: 'my@email.com'
});

reset

Empties (resets) all form fields:

var w = Ext.getCmp('my-window-id');
w.reset();

Hiding and Showing Fields

hideField / showField make form fields visible or hidden. Unlike MODx.FormPanel’s methods, these expect the field object, not its name:

var w = Ext.getCmp('my-window-id');
w.hideField(w.fp.getForm().findField('email'));
w.showField(w.fp.getForm().findField('comments'));

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.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • YJ
  • Murray Wood
  • JT Skaggs
  • Anton Tarasov
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

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

Learn more