While I submit a form that doesn't contain the "filefield" xtype it works well.
But when a add the filefiled xtype.the form opens a new window that request to the community_save.do. How to prevent the form to opening a new window,just get the response and call my callback method "success"? form definition below:
Code:
xtype: 'form',
url: 'community_save.do',
bodyPadding: 5,
items: [
{
xtype: 'hiddenfield',
name : 'id',
fieldLabel: 'ID'
},
{
xtype: 'textfield',
name : 'name',
fieldLabel: '名称',
allowBlank: false
},
{
xtype: 'filefield',
name : 'map',
fieldLabel: '小区地图',
msgTarget: 'side',
buttonText: 'Choose a Image File'
}]
handler code below:
Code:
saveCommunity: function(button) {
var win = button.up('window'),
form = win.down('form').getForm();
if (form.isValid()) {
form.submit({
waitMsg: 'Uploading your map...',
success: function(form, action) {
Ext.Msg.alert('提示', action.result.msg);
win.close();
this.loadActivities();
},
failure: function(form, action) {
Ext.Msg.alert('提示', action.result.msg);
},
scope: this
});
}
},
Thanks a lot for your answer!!!