Search code examples
sencha-touchsencha-touch-2

Sencha Touch proxy send post request with dynamic arguments


I want to send post request in sencha touch and the arguments I want to post are dynamic i.e. I want to take the textField values as a parameters to post. Please help me

proxy: {
     type: "ajax",
        url:'http://anotherserver.com/query.php',
        method:'post',
    extraParams: {
        val: "TextField1.Text" // **here I want to provide the value of the textField help me plz**
    },
    reader: {
        type: "json",
        rootProperty: "notes",
        totalProperty: "total"
    }
},

Solution

  • Usually you want to wrap the text field inside a form (formpanel). Then you can use

    var form = Ext.Viewport.down('.formpanel'),
        values = form.getValues(),
        textfieldValue = values.textfield_name;
    ...
    extraParams: {
        val: textfieldValue
    },