Hi!
I have a question what is the proper way to pass form values to Ext.Ajax.request.
Here is my code:
Code:
var panelForm = Ext.create('Ext.form.Panel', {
width: 300,
renderTo: 'fileUpload',
items: [
{
xtype: 'filefield',
name: 'document',
hideLabel: true,
anchor: '100%'
}
],
buttons: [
{
text: 'Upload',
handler: function() {
var form = panelForm.getForm();
/* form.submit({
url: '<s:url namespace="/ajax" action="uploadFile" />',
success: function(fp, o) {
alert('success');
}
});*/
logMessage(panelForm.getForm().getValues());
Ext.Ajax.request({
url : "<s:url namespace="/ajax" action="uploadFile" />",
params : form.getValues(),
method: 'POST',
success : function(response){
console.log(response.responseText);
}
});
}
}
]
});
The commented version using form.submit() works correctly - parameters are passed in submit request.
I am not sure what I am doing wrong. Should params or extraParams property be used in Ext.Ajax.request? I have tried to use both and I also have tried to use form.getFieldValues() but no positive result.
Thanks for help.
Regards,
Luke