我用别的组件都能回调到success里面,但使用fileupload组建却回调不到success里面,老是提示有文件下载。请问是怎么回事?
var fp = new Ext.FormPanel({
/// renderTo: 'fi-form',
fileUpload: true,
width: 500,
frame: true,
title: 'File Upload Form',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'contents',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Save',
handler: function(){
if(fp.getForm().isValid()){
fp.getForm().submit({
url: 'deleteWorklogdiy.action',
waitMsg: 'Uploading your photo...',
timeout : 2000,
success : function(fp, action) {
pic_out.hidden();
Ext.Msg.alert("信息提示", "OK");
},
// 提交失败的回调函数
failure : function() {
pic_out.hidden();
Ext.Msg.alert('错误', '服务器出现错误请稍后再试!');
}
});
}
}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});var pic_out = new Ext.Window({
title : 'pic',
width : 600,
height : 300,
closeAction : 'hide',
constrain : true,
modal : true,
items : [fp]
});
function uploadpicfunction(){
pic_out.show();}
var fp = new Ext.FormPanel({
/// renderTo: 'fi-form',
fileUpload: true,
width: 500,
frame: true,
title: 'File Upload Form',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'textfield',
fieldLabel: 'Name'
},{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'contents',
buttonText: '',
buttonCfg: {
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Save',
handler: function(){
if(fp.getForm().isValid()){
fp.getForm().submit({
url: 'deleteWorklogdiy.action',
waitMsg: 'Uploading your photo...',
timeout : 2000,
success : function(fp, action) {
pic_out.hidden();
Ext.Msg.alert("信息提示", "OK");
},
// 提交失败的回调函数
failure : function() {
pic_out.hidden();
Ext.Msg.alert('错误', '服务器出现错误请稍后再试!');
}
});
}
}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});var pic_out = new Ext.Window({
title : 'pic',
width : 600,
height : 300,
closeAction : 'hide',
constrain : true,
modal : true,
items : [fp]
});
function uploadpicfunction(){
pic_out.show();}
老是提示有文件下载这句话没在你代码看到,难道是浏览器的?
success为true时回调到success里面
success为false时回调到failure里面
是不是你同时返回了{success:true,failure:false}起了冲突?
这个估计要看看form.panel是怎么封装的了~~