FormPanel throwing an error..

March 18th, 2010
  • Hi,

    Briefly, I have a javascript file that contains a FormPanel (based on demo) as follows:


    var renderUserAdminForm = function(){
    var userForm = new Ext.form.FormPanel({
    title: 'User Details',
    renderTo: 'admin-user-form',
    height: 300,
    width: 350,
    items: [
    new Ext.form.FieldSet({
    title: 'Contact Information',
    autoHeight: true,
    defaultType: 'textfield',
    items: [
    {
    fieldLabel: 'Username',
    name: 'username',
    width:190
    },{
    fieldLabel: 'First Name',
    name: 'fname',
    width:190
    }, {
    fieldLabel: 'Last Name',
    name: 'lname',
    width:190
    }, {
    fieldLabel: 'Email',
    name: 'email',
    vtype:'email',
    width:190
    }
    ]
    })
    ]
    });
    };

    renderUserAdminForm();


    When it renders to the page I get an error stating, 'this.el has no properties'.

    This error occurs in the ext-all.js file at line 133 which contains many references to this.el beginning with:


    this.el=Ext.get(A);this.id=this.el.idExt.id();th is.el.on("submit",this.onSubmit,this);this.el.addClass("x-form")},getEl:function(){return



    When viewing in Firebug, el is null at time of execution. What element is Ext looking for and why is it not finding it? Did I forget to add something?

    Thanks!


  • fire it when ext is ready :)

    Ext.onReady(function() {
    new Ext.form.FormPanel({
    title: 'User Details',
    renderTo: 'test',
    height: 300,
    width: 350,
    items: [
    new Ext.form.FieldSet({
    title: 'Contact Information',
    autoHeight: true,
    defaultType: 'textfield',
    items: [
    {
    fieldLabel: 'Username',
    name: 'username',
    width:190
    },{
    fieldLabel: 'First Name',
    name: 'fname',
    width:190
    }, {
    fieldLabel: 'Last Name',
    name: 'lname',
    width:190
    }, {
    fieldLabel: 'Email',
    name: 'email',
    vtype:'email',
    width:190
    }
    ]
    })
    ]
    });

    });


  • it is looking for some form tag. so shud the rendorTo be a form tag or div i suppose


  • This error occurs in the ext-all.js file at

    Why aren't you using ext-all-debug.js, especially when you're having problems?


  • Hi,

    Thanks for responding.

    I have the renderTo rendering to a div tag. I'll have to check to see if it is supposed to be a form tag. Not sure on that.

    I enabled Ext's debugging and it complains at line 27395 of ext-all-debug.js:


    {27393} initEl : function(el){
    {27394} this.el = Ext.get(el);
    {27395} this.id = this.el.id Ext.id(); <<<<----


  • Thanks Jerry.

    I was goofy and didn't include the OnReady function in my post. Sorry about that.

    Turns out there was a standard tag in my HTML that was confusing Ext. I removed it and the problem went away.

    Sorry to have bothered you for a silly html issue..


  • har har
    http://pics.livejournal.com/rethought/pic/00084dtk







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about FormPanel throwing an error.. , Please add it free.