Ext.onReady(function()
{
var fp = new Ext.FormPanel({
renderTo: 'hello',
// fileUpload: true,文件上传
width: 500,
frame: true,
standardSubmit:true,//传统的表单提交
title: 'File Upload Form',
autoHeight: true,
// bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
name:'label_fileUpload',
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an file',
fieldLabel: 'Photo',
name: 'file_path',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
// ,
// autoCreate : {
// tag : "input",
// type : "file",
// size : "20",
// autocomplete : "off",
// onChange : "browseImages(this.value);"
// }
}],
buttons: [{
text: 'Save',
handler:formSubmit//设置Save函数
// handler: function(){
// if(fp.getForm().isValid()){
// fp.getForm().submit({
// url: '../File_upload',
// waitMsg: 'Uploading your file',
// success: function(form, action){
// alert('success');
// }
// ,failure:function(form,action){
// alert('failure');
// }
// });
// }
// }
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});
function formSubmit(){
fp.getForm().getEl().dom.action="../File_upload";
fp.getForm().submit();
}
});
ext 以传统的表单提交
最新推荐文章于 2021-08-06 20:40:53 发布