Ext.onReady( function (){
var form = new Ext.form.FormPanel({
labelAlign: 'right',
title: 'form',
labelWidth: 50,
frame:true,
fileUpload: true,
url:" ext2Upload.action",
width: 380,
items: [{
xtype: 'textfield',
fieldLabel: '文本框',
name: 'file1',
inputType: 'file'//文件类型
}],
buttons: [{
text: '保存',
handler: s
}]
});
function s() {
form.getForm().submit({//客户端的数据提交给服务器
waitTitle:"请稍候",
waitMsg:"正在提交表单数据,请稍候。。。。。。",
//如果submit失敗,執行這一個function
failure:function(){
Ext.MessageBox.hide();
Ext.MessageBox.alert('Error','失败');
},
success: function(){
Ext.MessageBox.hide();
Ext.MessageBox.alert('Success','成功');
}
});
}
form.render("fileUpload");
});