1. #1
    Ext User
    Join Date
    Jul 2007
    Posts
    91
    Vote Rating
    0
    fsa3 is on a distinguished road

      0  

    Default Error trying to render formPanel

    Error trying to render formPanel


    I'm trying to render a form panel to a div in the markup, I keep getting this.body is null. I did some searching and it looks like this is related to not having items, but I do...

    What am I missing?

    Code:
    var f = new Ext.FormPanel({
               labelWidth: 150,
               url: '/A_ContactUs.jsp',
               defaults: {width: 250},
               items: [
                       
                           {xtype: 'textfield',
                        fieldLabel: 'Your Email Address',
                        name: 'email',
                        vtype: 'email',
                        allowBlank: false},
                       
                       {xtype: 'textfield',
                        inputType: 'textfield',
                        fieldLabel: 'Subject',
                        name: 'subject',
                        allowBlank: false},
                       
                       {xtype: 'textarea',
                        inputType: 'textarea',
                        fieldLabel: 'Message',
                        name: 'message',
                        allowBlank: false,
                        grow:true}
                         
    
                        ],
               buttons: [{text: 'Submit',
                   minWidth: 75,
                   handler: function() {
                           if (f.getForm().isValid())
                           {
                               f.getForm().submit({
                                   waitMsg:'Sending Message...',
                                   success: function(form, action) {
                                            Ext.Msg.alert("Success","Your Message Has Been Sent.");
                                   },
                                failure: function(form, action) {
                                    switch (action.failureType) {
                                        case Ext.form.Action.CLIENT_INVALID:
                                            Ext.Msg.alert("Failure", "Form fields may not be submitted with invalid values");
                                            break;
                                        case Ext.form.Action.CONNECT_FAILURE:
                                            Ext.Msg.alert("Failure", "Ajax communication failed");
                                            break;
                                        case Ext.form.Action.SERVER_INVALID:
                                           Ext.Msg.alert("Failure", action.result.msg);
                                       }
                                    }
                               }
                               );
                           }
                           else
                           {
                               Ext.Msg.alert('Error', 'Please Complete the form!');
                           }
                            }}]
           });
           f.render('contactus');

  2. #2
    Ext User
    Join Date
    Jul 2007
    Posts
    91
    Vote Rating
    0
    fsa3 is on a distinguished road

      0  

    Default


    I've tried a few different things - no luck - I'd really appreciate a second pair of eyes.

    Thanks.

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. TextField inputType:'textfield' is invalid (see here).
    2. TextArea doesn't have an inputType config option.
    3. Are you sure there is an element with id="contactus"? Did you put this code in Ext.onReady?

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    91
    Vote Rating
    0
    fsa3 is on a distinguished road

      0  

    Default


    I updated the code and still no luck. I added two alerts for debugging, I see both get run and for the second I see that there is a HTMLDivElem called contact us.

    Code:
    function createContactUs()
    {
    alert('x');
    var f = new Ext.FormPanel({
               labelWidth: 150,
               url: '/A_ContactUs.jsp',
               defaults: {width: 250},
               items: [
                       
                           {xtype: 'textfield',
                        fieldLabel: 'Your Email Address',
                        name: 'email',
                        vtype: 'email',
                        allowBlank: false},
                       
                       {xtype: 'textfield',
                        fieldLabel: 'Subject',
                        name: 'subject',
                        allowBlank: false},
                       
                       {xtype: 'textarea',
                        fieldLabel: 'Message',
                        name: 'message',
                        allowBlank: false,
                        grow:true}
                         
    
                        ],
               buttons: [{text: 'Submit',
                   minWidth: 75,
                   handler: function() {
                           if (f.getForm().isValid())
                           {
                               f.getForm().submit({
                                   waitMsg:'Sending Message...',
                                   success: function(form, action) {
                                            Ext.Msg.alert("Success","Your Message Has Been Sent.");
                                   },
                                failure: function(form, action) {
                                    switch (action.failureType) {
                                        case Ext.form.Action.CLIENT_INVALID:
                                            Ext.Msg.alert("Failure", "Form fields may not be submitted with invalid values");
                                            break;
                                        case Ext.form.Action.CONNECT_FAILURE:
                                            Ext.Msg.alert("Failure", "Ajax communication failed");
                                            break;
                                        case Ext.form.Action.SERVER_INVALID:
                                           Ext.Msg.alert("Failure", action.result.msg);
                                       }
                                    }
                               }
                               );
                           }
                           else
                           {
                               Ext.Msg.alert('Error', 'Please Complete the form!');
                           }
                            }}]
           });
           alert(document.getElementById('contactus'));
           f.render('contactus');
    }

Thread Participants: 1