We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8579
    • 4 Posts
    I've been trying to use this code in order to apply default values to my fields:
    Choo.window.CreateEntry = function( config )
    {
      config = config || {};
      Ext.applyIf( config, {
        title: 'Adding Featured Entry',
        url: Choo.config.connector,
        baseParams: { action: 'entry-create' },
        fileUpload: true,
        defaults: { xtype: 'textfield', width: '410' },
        fields: [{
          fieldLabel: 'Entry Image',
          name: 'image',
          inputType: 'file'
        },{
          fieldLabel: 'What up',
          name: 'text'
        }]
      });
      Choo.window.CreateEntry.superclass.constructor.call( this, config );
    };
    Ext.extend( Choo.window.CreateEntry, MODx.Window );
    Ext.reg( 'choo-window-entry-create', Choo.window.CreateEntry );
    However, from testing it seems that the defaults parameter only applies to items and not fields, so the xtype and width do not get set. Is there a way I can get the defaults to apply also to fields, or do I need to use items?

    Thanks
      Ellis Grouse / Development Ninja

      <a href="http://egrouse.com" target="_blank">egrouse.com</a> | <a href="mailto:[email protected]">[email protected]</a> | <a href="http://twitter.com/_egrouse" target="_blank">Twitter</a> | <a href="https://plus.google.com/111889613851379377602/about" target="_blank">Google+</a> | <a href="http://www.linkedin.com/in/egrouse" target="_blank">LinkedIn</a>