1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default Answered: Form.reset() and datepicker issue

    Answered: Form.reset() and datepicker issue


    I have a form with two datepicker fields. If I select some date, then clear my form (button who throws the form.reset() method) and want to reselect some date, I get the following console message :

    Uncaught TypeError: Cannot call method 'toDateString' of null

    Anyone already had the same issue ?


    For information, same issue appears when I clear only the datepicker field with my custom datepicker clear button, code's here :

    Code:
                         {
                              xtype: 'datepickerfield',
                              itemId: 'dateFromField',
                              name: 'dateFrom',
                              locales: {                          
                                label: 'fields.dateFrom'
                              },
                              dateFormat: 'd/m/Y',                           
                              picker : {                              
                                  toolbar : {
                                      items : [
                                          {
                                              locales: {                          
                                                text: 'buttons.clear'
                                              },
                                              ui      : 'decline',
                                              align   : 'right',
                                              handler : function(btn) {
                                                  var picker = btn.up('datepicker');
                                                  picker.fireEvent('change', picker, null);
                                                  picker.hide();
                                              }
                                          }
                                      ]
                                  },
                                  enableLocale : true,
                                  locales: {
                                    months: 'months'
                                  },
                                  yearFrom: 2010,
                                  slotOrder:['day', 'month', 'year'] 
                              }
                          },



  2. What ST2 version are you using? I just tried this with 2.0.0 and 2.0.1.1 and it works without any errors:

    Code:
    new Ext.form.Panel({
        fullscreen : true,
        items      : [
            {
                xtype : 'datepickerfield',
                label : 'Date'
            },
            {
                xtype   : 'button',
                text    : 'Reset',
                handler : function(button) {
                    var form = button.up('formpanel');
    
                    form.reset();
                }
            }
        ]
    });

  3. #2
    Sencha User
    Join Date
    Apr 2012
    Location
    ShenZhen, China
    Posts
    52
    Answers
    11
    Vote Rating
    3
    liaoyiwu is on a distinguished road

      0  

    Default


    Need a value property

  4. #3
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default


    Ok thank you, it works if I set the value.

    But then, if I want to allow the possibility to doesn't specify the date, how can I do it ?

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What ST2 version are you using? I just tried this with 2.0.0 and 2.0.1.1 and it works without any errors:

    Code:
    new Ext.form.Panel({
        fullscreen : true,
        items      : [
            {
                xtype : 'datepickerfield',
                label : 'Date'
            },
            {
                xtype   : 'button',
                text    : 'Reset',
                handler : function(button) {
                    var form = button.up('formpanel');
    
                    form.reset();
                }
            }
        ]
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    May 2012
    Posts
    21
    Answers
    2
    Vote Rating
    0
    Greezer is on a distinguished road

      0  

    Default


    I just update the SDK to 2.0.1.1 and it works, I was with the 2.0.1... Don't know what was wrong !
    Thank you

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi