PDA

View Full Version : File Upload successful .... screen still masked!



mjhaston
28 Feb 2013, 11:01 AM
From what I can see my files are being uploaded successfully. They are on the server.

I'm returning a JSON response in "text/html" format like always.

My problem is my screen remains masked or grayed out!




FormPanel:


var uploadPanel = Ext.create('Ext.form.Panel', {
fileUpload : true,




Input field:


items : [{
xtype : 'fileuploadfield',
id : 'filesnt',




Submit upload file:



if (uploadPanel.getForm().isValid()) {
uploadPanel.getForm().submit({
url : '/cgi-bin/fuploadext.pgm',
waitMsg : 'Uploading your file...',

success : function(uploadPanel, o) {
// do whatever you need to with the generated HTML
console.log(o.response.responseText);
},
failure : function() {
console.log('failure');
}
});
}




JSON reply from program code:


string = 'Content-type: text/html' +x'25' +x'25'
+ '{ '
+ ' "success" : true, '
+ ' "data" : [{'
+ ' "responseText" : "good", '
+ ' "someData" : "x" '
+ ' }] '
+ '} '
;




JSON reply in Firebug:



{
"success": true,
"data": [
{
"responseText": "good",
"someData": "x"
}
]
}

sword-it
28 Feb 2013, 11:16 PM
Hi majhaston,

Try to give "waitMsgTarget: true" to the formPanel, like-


Ext.create('Ext.form.Panel', {
title: 'Simple Form',
bodyPadding: 5,
waitMsgTarget:true,
width: 350,
url: 'save-form.php',
layout: 'anchor',
defaults: {
anchor: '100%'
},
defaultType: 'textfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
xtype:'fileuploadfield',
name: 'last',
allowBlank: false
}],
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true, //only enabled once the form is valid
disabled: true,
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
url : '/cgi-bin/fuploadext.pgm',
waitMsg : 'Uploading your file...',
success: function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}],
renderTo: Ext.getBody()
});