Question

I have form with extjs like this:

        {
            xtype : 'textfield',
            fieldLabel : 'name',
            name : 'vTitle',
            allowBlank : false
        },{
            xtype : 'datefield',
            fieldLabel : 'name',
            name : 'date',
            allowBlank : false
        }

when I submit form value send to server like this:

Parameters:
 vTitle:mm
 date:9/11/2011

When I submit the form I want my own value to send instead of the default value. For example when I submit the date: 9/11/2011 I want the date: my value related with 9/11/2011 sent to server.

I used setvalue for my form but if I have error from server my default form value's changes and I do not want use setvalue.(only I want send my own value to server)

Was it helpful?

Solution

Ext.Ajax.request({
    url:'requestURL.ajax',
    params:{
       // date: 'your modified date' OR date: date.getValue(), or whatever you want..
    },
    success: function(response, options){

    },
    failure: function(resp, action){

    }
});

It will make an Ajax call, and you will be able to send any parameter inside it, and also you can handle its response inside success & failure..

OTHER TIPS

You can do it by setting submitValue to false on this two fields, and by creating hidden field which will contain computed value. When you set submitValue to false value from field won't be submited as name implies, so only hidden field value will be submited. So you only need to create handler to update value in hidden field (for example you can create handler for Ext.form.BasicForm.beforeaction event).

Working sample: http://jsfiddle.net/3zmvJ/2/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top