我一点提交的时候,问题提示我的form为空,或不是对象。帮帮看看~!
代码如下:<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var form = new Ext.form.FormPanel({
  
labelAlign: 'left',
title: '测试 Form',
buttonAlign:'right',
bodyStyle:'padding:2px',
url: '/get_sys_data',
width: 330,
frame:true,
labelWidth:55,
height: 200,
items: [{
layout:'column',  
border:true,
labelSeparator:':',
items:[{ bodyStyle:'padding:5px',
layout: 'form',
id:'sform',
border:false,
width: 300,
monitorValid:true,
defaults:{  
              anchor:'95%',  
              allowBlank:false  
          },

items: [{                     
cls : 'key',
xtype:'textfield',
fieldLabel: 'test1',
emptyText:'input something',
blankText:'pls input something' ,
name: 'test1', },{                    
cls : 'key',
xtype:'textfield',
fieldLabel: 'test2',
emptyText:'input something',
blankText:'pls input something' ,
name: 'test2', },{                    
cls : 'key',
xtype:'textfield',
fieldLabel: 'test3',
emptyText:'input something',
blankText:'pls input something' ,
name: 'test3',
}],
  buttons:[{
   text:"Save",
   handler:function(){
 alert(this.ownerCt.ownerCt.items.itemAt(0).getValue());
     form.getForm().getEl().dom.action = 'test.php';  
                  form.getForm().getEl().dom.method = 'POST';  
                  form.getForm().submit();  




    },formBind:true},
{text:"Reset",
handler:function(){
  form.form.reset();
   }}]
}
]
}]
}).render('system_data');  
 }); 
</script>

解决方案 »

  1.   


    <script type="text/javascript"> 
    Ext.onReady(function(){ 
    Ext.QuickTips.init(); 
    Ext.form.Field.prototype.msgTarget = 'side'; 
    var form = new Ext.form.FormPanel({ 
      
    labelAlign: 'left', 
    title: '测试 Form', 
    buttonAlign:'right', 
    bodyStyle:'padding:2px', 
    url: '/get_sys_data', 
    width: 330, 
    frame:true, 
    labelWidth:55, 
    height: 200, 
    items: [{ 
    layout:'column',  
    border:true, 
    labelSeparator:':', 
    items:[{ bodyStyle:'padding:5px', 
    layout: 'form', 
    id:'sform', 
    border:false, 
    width: 300, 
    monitorValid:true, 
    defaults:{  
                anchor:'95%',  
                allowBlank:false  
            }, items: [{                    
    cls : 'key', 
    xtype:'textfield', 
    fieldLabel: 'test1', 
    emptyText:'input something', 
    blankText:'pls input something' , 
    name: 'test1'},{                    
    cls : 'key', 
    xtype:'textfield', 
    fieldLabel: 'test2', 
    emptyText:'input something', 
    blankText:'pls input something' , 
    name: 'test2'},{                    
    cls : 'key', 
    xtype:'textfield', 
    fieldLabel: 'test3', 
    emptyText:'input something', 
    blankText:'pls input something' , 
    name: 'test3'
    }], 
      buttons:[{ 
      text:"Save", 
      handler:function(){ 
    alert(this.ownerCt.ownerCt.items.itemAt(0).getValue()); 
      form.getForm().getEl().dom.action = 'test.php';  
                    form.getForm().getEl().dom.method = 'POST';  
                    form.getForm().submit();  
      },formBind:true}, 
    {text:"Reset", 
    handler:function(){ 
    form.form.reset(); 
      }}] 


    }] 
    }).render('system_data');  
    }); 
    </script>