title:'form測試',
bodyPadding:10,
renderTo:Ext.getBody(),
width:300,
height:200,
url:'formdata.txt',
defaultType: 'textfield',
items:[
{
name:'name',
fieldLabel:'姓名',
allowBlank: false,
msgTarget:'under',
blankText:'姓名必須輸入'
},
{
xtype:'numberfield',
name:'year',
fieldLabel:'年齡',
maxValue:500,
minValue:1
}
],
buttons:[
{
text:'重置',
handler:function(){
this.up('form').getForm().reset();
}
},
{
text:'提交',
handler:function(){
var formPanel = this.up('form');
}var form = this.up('form').getForm();if (form.isValid()) {form.submit({success: function(form, action) {Ext.Msg.alert('Success', action.result.msg);formPanel.close();},failure: function(form, action) {Ext.Msg.alert('Failed', action.result.msg);}});}
}
]
});
}
success:true,
msg:'成功的提交'
}
msgTarget:'under',
blankText:'姓名必須輸入'