Btw, my formpanel is defined like this:
Code:
Ext.define('app.view.NewFile', {
alias: 'widget.newfile',
extend: 'Ext.Window',
title: 'Last opp fil',
modal: true,
width: 500,
layout: 'fit',
initComponent: function() {
this.formPanel = Ext.create('Ext.form.Panel', {
fileUpload: true,
bodyStyle:'padding:5px 5px 0',
border: false,
items: [{
xtype: 'textfield',
name: 'filename',
autoHeight: true,
allowBlank: false,
fieldLabel: 'Navn',
blankText: 'Navn'
}, {
xtype: 'textfield',
name: 'destination',
autoHeight: true,
allowBlank: false,
fieldLabel: 'Container',
blankText: 'Container'
},{
xtype: 'filefield',
emptyText: 'Velg fil..',
fieldLabel: 'Fil',
name: 'filedata',
width: 400,
buttonText: 'Velg'
}],
buttons: [{
text: 'Lagre',
action: 'save'
}]
});
this.items = [this.formPanel],
this.callParent(arguments);
}
});
And submitcode:
Code:
createFile : function(button) {
var window = button.up('window');
var form = window.down('form').getForm();
if(form.isValid()) {
form.submit({
url: '/alfresco/service/api/upload' + '?alf_ticket=' + app.session,
waitMsg: 'Laster oppe filene',
success: function(form, action) {
alert('yeah');
},
failure: function(form, action) {
alert('feil');
}
});
}
}
Anyone?