PDA

View Full Version : [Fixed] 1.1RC1 form.submit for files creates popup on IE6 (RC2 to fix)



jay@moduscreate.com
10 Jul 2007, 12:53 PM
Test here:
http://tdg-i.com/extexamples/fileupload2/
insert a picture, click submit, i get a popup in ie6 and IE7, not FF2, 1.5x


Ext.onReady(function() {
var fileUploadStatus = new Array(5);
fileUploadStatus[0] = 'OK';
fileUploadStatus[1] = 'FAILED TO UPLOAD' ;
fileUploadStatus[2] = 'ALREADY EXISTS';
fileUploadStatus[3] = 'WRONG EXTENSION';
fileUploadStatus[4] = 'BAD SIZE';


// define some private variables
var dialog, showBtn;
var uploadedPicsTemplate = new Ext.Template(
"<a href='media/{fileName}' target='new'><img border='0' src='image.php?size=75&media_file={fileName}' id='img_{id}' /></a>"
);
var form = new Ext.form.Form({
labelWidth: 50,
labelAlign: 'left',
name: 'uploadForm',
fileUpload : true,
method: 'POST',
url:'photoManager.php',
buttonAlign: 'left',
baseParams: { action : 'upload' }
});
form.add(
new Ext.form.TextField({
fieldLabel: 'Photo 1',
name: 'pictureUpload1',
id: 'pictureUpload1',
inputType: 'file',
width: 200,
allowBlank: true
}),
new Ext.form.TextField({
fieldLabel: 'Photo 2',
name: 'pictureUpload2',
id: 'pictureUpload2',
inputType: 'file',
width: 200,
allowBlank: true
})
);

form.addButton('Submit', submitForm);
form.render('frmPicUpload2');
function submitForm() {
if (form.isValid()) {
Ext.MessageBox.wait('uploading photos', 'Please wait');
form.submit({
// callback handler if submit has been successful
success:function(form, action){
Ext.MessageBox.hide();
checkMessage(action.result.msg.files);
},
failure: function(form, action) {
Ext.MessageBox.hide();
Ext.MessageBox.alert('Failure', action.result.msg);
}
});
}
}
function checkMessage(data) {
// Error Codes:
// 0 : OK
// 1 : FAILED TO UPLOAD
// 2 : ALREADY EXISTS
// 3 : WRONG EXTENSION
// 4 : BAD SIZE
var summary = '';

for ( i=0; i < data.length; i++ ) {


if ( data[i].fileStatus == 0 ) {
fileNum = data[i].file;

form.findField('pictureUpload' + fileNum).reset();
uploadedPicsTemplate.append('photoList', {fileName: data[i].fileName });
}
else {
form.findField('pictureUpload' + data[i].file).markInvalid(fileUploadStatus[data[i].fileStatus]);
}
summary += 'File ' + data[i].file + ':' + fileUploadStatus[data[i].fileStatus] + '<br />';
}
Ext.MessageBox.alert('uploadStatus', summary);
}

});

jack.slocum
10 Jul 2007, 2:14 PM
Did you try it with 1.1 RC1?

jay@moduscreate.com
10 Jul 2007, 6:02 PM
no sir, will do so and report back :)

jay@moduscreate.com
11 Jul 2007, 6:00 AM
Did you try it with 1.1 RC1?

Updated to RC1 today, same issue. This bites :(

jay@moduscreate.com
12 Jul 2007, 2:47 AM
bump so it doesn't lose any momentum/focus. :)

jay@moduscreate.com
13 Jul 2007, 5:57 AM
Fixed in SVN.

EDIT: removed SVN link.

can be tested: http://www.tdg-i.com/extexamples/fileupload

http://www.tdg-i.com/extexamples/bug_screenshots/ext_ie_popup_bug_fixed.jpg