Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submit Extjs form via PUT Method

Tags:

extjs

Is it possible to submit extjs form via HTTP PUT method? I want to update record on Rails 3, which accept PUT method to update.

Here is my code:

formData.submit({       url: "/layers/" + param.layer_id + "/rules_property_thresholds/" + param.id ,
        method:'PUT',
        params: param,
        waitTitle: "Please wait...",
            waitMsg: 'Updating rule property threshold...',
                    .........
             });

I place method PUT but the request still doing POST when I check on Firebug(Net). Thanks

like image 436
Sokmesa Khiev Avatar asked May 03 '26 03:05

Sokmesa Khiev


1 Answers

Only HTML5 is supporting PUT via the form directly. Forms up until now only support GET & POST.

For now you need to use ajax to submit the form via PUT:

Ext.Ajax.request({
        url: 'your url', // you can fix a parameter like this : url?action=anAction1
        method: 'PUT',
        params: {
            myField1: myField1.getValue()
            // all your params.... 
        }
        success: function (result, request){
            alert('Succesfully added ' + result.responseText);
        },
        failure: function (result, request){
            alert('Error in server' + result.responseText);
        }
 );
like image 73
jenson-button-event Avatar answered May 04 '26 19:05

jenson-button-event