1. #11
    Sencha Premium Member alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    107
    Vote Rating
    7
    Answers
    3
    alexander.urban is on a distinguished road

      0  

    Default


    Please post the code how you submit it. Do you submit the store, the model or the form?

  2. #12
    Sencha User
    Join Date
    Jan 2015
    Posts
    1
    Vote Rating
    0
    jlevillain is on a distinguished road

      0  

    Default


    I have the same problem.
    Code:
    
    Here is my form :
     items: [{
            xtype:'form',
            id:'form',
            jsonSubmit:true,
            width:'40%',
            url:'/webapp-2.1.1-RELEASE/AllComputer/add',
            items:[{
                xtype:'textfield',
                fieldLabel:'Computer Name',
                name:'name',
                allowBlank:false,
                width:'100%'
            }, {
                xtype:'datefield',
                fieldLabel:'Introduced Date',
                name:'introduced',
                format:'d/m/Y',
                submitFormat:'d/m/Y',
                submitValue:true,
                width:'100%'
            },{
                xtype:'datefield',
                fieldLabel:'Discountinued Date',
                name:'discontinued',
                format:'m/d/Y',
                submitFormat:'m/d/Y',
                submitValue:true,
                width:'100%'
            },{
                xtype:'combobox',
                id:'comboBox',
                name:'company',
                fieldLabel:'Company',
                store:'CompanyStore',
                queryMode:'local',
                valueField:'id',
                displayField:'name',
                editable:false,
                allowBlank:false,
                forceSelection:true,
                autoLoadOnValue:true,
                width:'100%',
                submitValue:false
            },{
                xtype:'toolbar',
                width:'100%',
                layout:{
                  pack:'center'
                },
                items:[
                    {
                    xtype:'button',
                    text:'Add',
                    handler:'AddComputer',
                    formBind: true, //only enabled once the form is valid
                    disabled: true
                },{
                    xtype:'component',
                    html:'or'
                },{
                    xtype:'button',
                    text:'Cancel',
                    handler:'Cancel'
                }]
            }]
        }
    and my submit function :
    Code:
    AddComputer:function() {
            var form = Ext.getCmp("form");
            var comboBox = Ext.getCmp("comboBox");
            var id = comboBox.getValue();
            if (form.isValid()) {
                form.submit({
                    params:{
                        company:{id:id,name:""},
                        id:"-1"
                    },
                    success: function(form) {
                        Ext.Msg.alert('Success', "success");
                    },
                    failure: function(form, action) {
                        Ext.Msg.alert('Failed', "fail");
                    }
                });
            }
        }
    When i see the parameter of the submit. I don't have the expect result.
    params request of the sumit launch by Extjs

    {"company":{"id":"0","name":""},"id":"-1","name":"Toto5","introduced":"2015-01-08T00:00:00","discontinued":"2015-01-29T00:00:00"}