PDA

View Full Version : file upload file in an ext.window



anitsirc
10 Sep 2008, 11:51 AM
Hi there, I tried to put a Form with a FileUploadField into an Ext.Window and i don't know why it doesn't work properly. The browse icon and the form field appears in the main windows and not in the new Ext.Window where it should be.. Does anyone knows how to solve it or why does it happen?

Thanks

devnull
10 Sep 2008, 11:55 AM
It would help considerably to see your code.

anitsirc
10 Sep 2008, 12:14 PM
I just added this to file-upload.js example


var ImageForm = new Ext.FormPanel({
id: 'ImageForm',
width: 400,
autoHeight: true,
labelWidth: 50,
items: [{
xtype: 'fileuploadfield',
id: 'form-file',
emptyText: 'Select an image',
fieldLabel: 'Photo',
name: 'photo',
buttonCfg: {
text: '',
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Ok',
handler: function(){
if(ImageForm.getForm().isValid()){
var div = document.getElementsByTag('body').item(0);
var src = Ext.getCmp('ImageForm').getForm().findField('photo').getValue();
div.innerHTML += "<img src="+src+">";
}
}
},{
text: 'Cancel',
handler: function(){
ImgWin.close();
}
}]
});

var ImgWin = new Ext.Window({
id:'TableWin',
width:280,
minWidth:280,
minHeight:140,
layout:'fit',
border:false,
closable:true,
collapsible:false,
title:'Image',
items: ImageForm
});
ImgWin.show();

});

carol.ext
10 Sep 2008, 12:54 PM
Try changing the id of the file upload field that you are adding. It already exists in the example, I could see the field/button getting added to the form on the main page instead of the window some of the time.



xtype: 'fileuploadfield',
id: 'form-file-win',

anitsirc
10 Sep 2008, 1:12 PM
Thanks, i didn't see that there was an id property :$