Reputation: 1302
I am very new to EXTJS. Working on application with Form and Grid.
Form will have Browse (to upload docs), Combobox, textarea and Datefield. On submit, Progress bar have to appear to show progress of upload.
Document path, combobox field value, Text area value & Date value entered have to display in Grid. Delete button have to their by default in grid of each row, once value appeared.
I tried to submit form with POST method and output as JSON format. I can get value of other fields except Filefield. How to get filefield value???
Thanks
var form = Ext.getCmp('Docinfo').getForm();
if(form.isValid())
{
var record = form.getValues();
var output_json = {"header": Ext.JSON.encode(record)};
Ext.Ajax.request({
url:'data/CSApp.json',
waitMsg: 'Uploading your file...',
method: 'POST',
jsonData: output_json,
success: function(response) {
Ext.Msg.alert('Data submitted');
Ext.getCmp('Docinfo').getForm().reset();
},
failure: function(response) {
Ext.Msg.alert('Error while submitting data');
},
headers: {'Content-Type' : 'text/html' , 'Accept' : 'application/json'}
});
}
}
Upvotes: 0
Views: 3074
Reputation: 15673
First of all fileinput cannot be submitted via AJAX. Docs clearly describe this: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.File
Second, why are you using Ajax request to submit the form values instead of the Form submit function itself?
Upvotes: 0