1. #11
    Sencha Premium Member alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    114
    Vote Rating
    8
    Answers
    3
    alexander.urban will become famous soon enough

      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"}

  3. #13
    Sencha User
    Join Date
    Mar 2013
    Posts
    2
    Vote Rating
    0
    mcarballosam is on a distinguished road

      0  

    Default This was the only working answer that I found from documentation using version 4.2.1

    Code:
    Ext.Date.patterns = {
        ISO8601Long:"Y-m-d H:i:s",
        ISO8601Short:"Y-m-d",
        ShortDate: "n/j/Y",
        LongDate: "l, F d, Y",
        FullDateTime: "l, F d, Y g:i:s A",
        MonthDay: "F d",
        ShortTime: "g:i A",
        LongTime: "g:i:s A",
        SortableDateTime: "Y-m-d\\TH:i:s",
        UniversalSortableDateTime: "Y-m-d H:i:sO",
        YearMonth: "F, Y"
    };
    
    
    //allow max date as today
    Ext.override(Ext.form.DateField, {
        maxValue:new Date(),
        submitFormat:Ext.Date.patterns.ISO8601Short
    });

  4. #14
    Sencha Premium Member alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    114
    Vote Rating
    8
    Answers
    3
    alexander.urban will become famous soon enough

      1  

    Default

    @mcarballosam I would recommend against Ext.override.


    Ext.define('MyApp.override.DateField',{
    override:'Ext.form.DateField'


    is the new recommended way of overriding. Ext.override is deprecated and no longer part of newer ext versions.


    I would also recommend not to mess with the default formats of all date fields (this could have impact on derived fields, if such exist), but to use


    Ext.create('Ext.form.DateField',{
    maxValue:new Date(),
    submitFormat:Ext.Date.patterns.ISO8601Short
    });


    or, if it is embedded in a bigger (e.g. window/form) config


    {
    xtype:'datefield',
    maxValue:new Date(),
    submitFormat:Ext.Date.patterns.ISO8601Short
    }

  5. #15
    Sencha User
    Join Date
    Mar 2013
    Posts
    2
    Vote Rating
    0
    mcarballosam is on a distinguished road

      0  

    Default

    Alexander, thank you for the advice on the override method being deprecated.
    I am sorry I forgot to include on my post that I am using this as a global solution, because my intention is to override all date fields across the entire application on purpose, so I can achive the expected behaviour with that radical implementation.