PDA

View Full Version : form.submit sends POST and ignores method config



grnadav
22 May 2012, 12:46 AM
Hey

I'm trying to send a form but wants to config it to use PUT instead of POST,
here's my code:


var form = record.up('form').getForm();
form.submit({
url: '/some/url/',
method: 'PUT',
waitMsg: 'Uploading your photo...',
success: function(fp, o) {
Ext.Msg.alert('Success', 'Your photo "' + o.result.file + '" has been uploaded.');
}
});


but in the network I see it sends a POST request (thus causing my backend to deny the request as method not allowed)

What am I missing here?
Is this an ExtJS 4.1 bug?

Thanks

sword-it
22 May 2012, 2:33 AM
Hi grnadav,

I debug your code on firebug console, and find the form value submitted with "PUT" method.
May be you have browser cache problem, clear browser cache and try again.

börn
22 May 2012, 2:43 AM
I think (haven't actually tested it in ext4 yet) that the form submit has it's own proxy configuration and makes a classic form-submit-post without json data either. If you want to use your model's config - and you allready have a record (it's a model!) in your hand - why don't you save this record (record.save)? For synchronization of your form's data to the record use formPanel.getForm().updateRecord(record);. After that you can save it... and if you configured a rest-proxy you will see the wanted PUT, if the record's id is set and it's not phantom - otherwise it would be POST.

grnadav
23 May 2012, 10:50 PM
Well, I tested this again and again on Chrome. and it does send a POST on Chrome....