Results 1 to 8 of 8

Thread: getForm().load() and "this.form.el is undefined"

  1. #1

    Default getForm().load() and "this.form.el is undefined"

    Hi.

    While following tutorial I tried to filled my form with data from php.
    Unfortunately firebug throws error message: "this.form.el is undefined".

    Code looks like this:

    Code:
    formUser.getForm().load({
        url: 'phpDataGenerator.php?p=param&id=100',
        params: {
            id:'id'
        },
        failure: function(form, action) {
            Ext.Msg.show({title: "Data unavailable", msg: action.result.errorMessage});
        }
    });
    I can't figure out where i made mistake. Do you have any experiance with this kind of error?

  2. #2

  3. #3

    Default

    Quote Originally Posted by [email protected] View Post
    load after render

    It might be difficult because of structure of code i wrote. However i would like to ask you if there is any way to include load() into definition of particular FormPanel - that would resolve some of my problems?



    The code looks more or less like this (description):

    After clicking twice on grid another window is opened (id from row is sent). This window consists tabPanel. In first tab, there is a form in item[simpleForm]. Form is defined in another file. It should be filled with data based on id sent from grid. I must face problem of erasing data after closing window and clicking on grid again to open new window with new id (autoDestroy: false - failed somehow). If I would include load() into definition, i would define form in item[{formDefinition}] and handle my "destroy" nightmare . it is not elegant but for now it should be fine.

    I hope description above is clear.

  4. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    you can use the listeners-config of formPanel.

    like:

    Code:
    listeners : {
        render : function(){
            // form.load();
        }
    }

    kind regards,
    tobiu
    Best regards
    Tobias Uhlig

  5. #5

    Default

    Quote Originally Posted by tobiu View Post
    you can use the listeners-config of formPanel.

    like:

    Code:
    listeners : {
        render : function(){
            // form.load();
        }
    }
    kind regards,
    tobiu

    I hate to piggy back on this, but I have a related question. I have the following code inside my extended form class:


    Code:
    onRender: function() {
            // Call    parent
            ATAP.ViewApplication.superclass.onRender.apply(this, arguments);
    
            // Set wait    message    target
            this.getForm().waitMsgTarget = this.getEl();
    
            // Loads form after    initial    layout
            //this.on('afterlayout', this.loadData,    this, {single:true});
            this.on({
                afterlayout: {scope: this, single: true, fn: function()    {
                    this.loadData(); //    Load the form data
                    this.doLayout(); //    Adjust the height of the container after all elements have been    placed
                }}
            });    
     
        }, // End function onRender
    This works great in that all data is loaded after the form is rendered. However, I want to do some post-processing - namely disabling any tabs that do not have content (the tabs are just open-ended questions that were optional). The problem is, I cannot seen to get the value of the fields. Depending on where I place the following code, i either get undefined, [Object object], or just empty data.


    // Disable tabs for text fields that contain no content
    var f = this.getForm();
    var fn = f.findField('first_name').getValue();
    alert(fn);

    I tried placing this within "this.on" and got an empty string. Placing it outside of this.on (at the end of the onRender function) gets me undefined. I even tried moving it to the end of my loadData function and also get an undefined.

    Any ideas?

    Jim

  6. #6

    Default

    After more searching, found what I needed here:

    http://www.extjs.com/forum/showthread.php?t=20819

  7. #7
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    good morning from the gmt+1 timezone

    true, the load-method has callbacks like success for postprocessing.
    just out of curiosity: why do you set the listener for the event afterlayout in the event-listener-method for render and not directly in the formpanel?


    kind regards,
    tobiu
    Best regards
    Tobias Uhlig

  8. #8

    Default

    formUser.getForm() has not load() method;
    formUser has .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •