PDA

View Full Version : Fileupload opening up new browser window?



lshepherd
30 Nov 2009, 4:08 PM
I have the following code successfully posting to the correct url, BUT instead of the response returning to the same window, another window opens and the success handler for the form submission never gets called. Any ideas?



SRM.AddOrderPeptidesDialog = Ext.extend(Ext.Window, {
initComponent: function() {
var orderId = this.orderId;
Ext.apply(this, {
modal: true,
title: "Add peptides to order",
width: 500,
items: [
{
xtype: "form",
fileUpload: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
items: [
{
xtype: 'fileuploadfield',
emptyText: 'Select a file',
fieldLabel: 'Peptide File',
name: 'peptideFile',
buttonText: 'Choose a file'

}
],
buttons: [
{
text: 'Save',
handler: function() {
var form = this.findParentByType("form").getForm();
form.submit({
url: "orders/" + orderId + "/peptides",
waitMsg: 'Uploading your file...',
success: function(form, o) {
Ext.Msg.show({
title: 'Result',
msg: o.result.result,
buttons: Ext.Msg.OK,
icon: Ext.Msg.INFO
});
},
failure: function(form, o) {
Ext.Msg.show({
title: 'Result',
msg: o.result.error,
buttons: Ext.Msg.OK,
icon: Ext.Msg.ERROR
});
}
});
}
}
]

}
]

});

SRM.AddOrderPeptidesDialog.superclass.initComponent.apply(this, arguments);
}
});

14 Dec 2009, 8:11 AM
must be something with your browser. The file upload opens up an iframe to make it "ajaxy" but it's not really AJAX (using XMLHttpRequest)