We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39519 ☆ A M B ☆
    • 79 Posts
    I'm working on a CMP, and realized I can't add text fields to a tab in my update window without causing an error. I've tracked it down to this code around line 191-203 of modx.window.js. It looks to be conflicting with my extended window.
    I've had this issue for sure on 2.2.7 and 2.2.9
    loadDropZones: function() {
    if (this._dzLoaded) return false;
    var flds = this.fp.getForm().items;
    flds.each(function(fld) {
    if (fld.isFormField && (
    fld.isXType('textfield') || fld.isXType('textarea')
    ) && !fld.isXType('combo')) {
    new MODx.load({
    xtype: 'modx-treedrop'
    ,target: fld
    ,targetEl: fld.getEl().dom
    });
    }
    });
    this._dzLoaded = true;
    } 
      Mat Dave Jones
      • 39519 ☆ A M B ☆
      • 79 Posts
      *bump*

      Is anyone else getting this error. It's basically game ending for a really cool CMP I'm working on. I just get "Cannot read property 'dom' of undefined" and am unable to create new windows without hacky tactics.
        Mat Dave Jones
        • 39519 ☆ A M B ☆
        • 79 Posts
        Temporary solution so far is to add this to my code
        MODx.Window.override({
            loadDropZones: function() {
            }
        });
        
          Mat Dave Jones
          • 39519 ☆ A M B ☆
          • 79 Posts
          Two years later I finally revisited this, and got it figured out. Apparently if you have a MODX.Window with tabs, you need to cycle through each of the tabs on "activate", otherwise the elements aren't generated, and you have no 'dom' to load the DropZones into.

          At the bottom of your window put:

              test.window.Example.superclass.constructor.call(this,config);
          
              this.on('activate',function() {
                  Ext.getCmp(config.record.window+'-second-tab').show();
                  Ext.getCmp(config.record.window+'-first-tab').show();
              });
          };
          


          Adjusting the Ext.getCmp()'s to reflect the ID of each tab in reverse order.
            Mat Dave Jones