View Full Version : Clone/duplicate fileUploadField

30 Jul 2013, 11:11 AM
Hello guys,

I am trying to clone a fileUploadFIeld with no success. I need this cos i don't want to post the actual form, that holds the filed.

I am creating a new form, on change event of the fileUploadFIeld, add the El, parameter from change event, to this new form and post it. This works, but remove the file field from screen when i add eh EL into the new form.

I did try:

var fileCfg = el.cloneConfig();
var campoFileUpload = Ext.create('Ext.form.field.File', fileCfg);

When i POST the new form i don't get the selected file. I just want to clone/duplicate the on screen file field, to a new one, add to a new form and post it with the select file, on screen, without lost it.


Gary Schlosberg
5 Aug 2013, 10:26 PM
Are you giving the two fields different IDs? Any chance you could post more of your code?

6 Aug 2013, 4:25 AM
Hi there,

Thanks for your reply .

I do have a form with a filefield:

xtype: 'fileuploadfield',
id: 'uploadArquivosCGButton',
itemId: 'uploadArquivosCGButton',
itemid: 'uploadArquivosCGButton',
buttonText: 'Upload...',
buttonConfig: { width: '100%' },
name: 'file',
flex: 1,
vtype: 'ExtesaoUpload'

Then on controller bind chnage for the component to post:

'fileuploadfield[itemid=uploadArquivosCGButton]': {
change: function (el, val) {
var UPLOAD_URL = '/FilesUpload/Save';

var me = this,
fm = Ext.create('Ext.form.Panel', {
items: [el],
itemId: 'frmAux'
f = fm.getForm();

method: 'POST',
waitMsg: 'Sending...',
success: function (fp, o) {
failure: function (fp, o) {

But when add the El ont the new form, items: [el], the field is removed form the screen. SO i try to clone, create a new field to post, and keep the other filed on screen.

Thanks in advance