1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    8
    Vote Rating
    0
    twilsonxpert is on a distinguished road

      0  

    Default Datefield Auto Formatting

    Datefield Auto Formatting


    There is a "feature" of the datefield that I am trying to turn off. I don't want it to auto-format dates I put in. For example enter in "11" and it gets auto-formatted to the 11th of the current month. That's cool, but enter in "12345678" and it gets formatted to "01/03/5679" (Dec 34th doesn't exist so it goes 3 days further). Pretty nice, but this would be confusing to normal users. How do I turn it off? If you want to see it in action, the AJAX form demo does it.

    http://extjs.com/deploy/dev/examples/form/xml-form.html

  2. #2
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    I am having a hard time understanding why you would be typing "12345678" into a dateField. dateFields are meant to be used for dates, and entering in anything else would most certainly be confusing as it is abnormal user behavior.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    8
    Vote Rating
    0
    twilsonxpert is on a distinguished road

      0  

    Default


    Quote Originally Posted by devnull View Post
    dateFields are meant to be used for dates
    You are assuming that 12345678 is not a date, but ExtJS sees otherwise. It is a date just one in the distant future.

    Quote Originally Posted by devnull View Post
    abnormal user behavior.
    There are a lot of abnormal users on the internet. You never know what they'll try to input. Is there a way to disable it or not?

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    Again, I fail to see what can be accomplished here.
    Bad users will see a field and type whatever they want into it.
    Good users will see that it is a date field and type a date into it.
    You could write code until the end of time, but you are going to have a very difficult time creating a program that can tell the difference between "good" users and "bad" users. However you can help weed out the "bad" users by implementing validation.

  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    8
    Vote Rating
    0
    twilsonxpert is on a distinguished road

      0  

    Default


    OK. We already have server-side validation to check that dates are within a valid range.

  6. #6
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    DateField does have config properties for minDate and maxDate, as well as disabledDays and disabledDates, and of course support for custom validator functions...

  7. #7
    Ext User
    Join Date
    Dec 2007
    Posts
    28
    Vote Rating
    0
    manojo is on a distinguished road

      0  

    Default


    Hi,

    I think that DatePicker has minDate and maxDate, but it seems that DateField doesn't have these. How can I use DatePicker methods or implement my own ?

    Thanks,
    Manojo

  8. #8
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    The datefield itself respects the validation functions the same as any other field does; marks itself as invalid.

  9. #9
    Ext User
    Join Date
    Dec 2007
    Posts
    28
    Vote Rating
    0
    manojo is on a distinguished road

      0  

    Default


    Hi,
    thanks for the answer, but I think you didn't understand my question. I was saying that the DateField class has no minDate property as such. So does this mean I have to go and extend DateField by adding a minDate property ? Or is there actually a way I can bypass this?

    Thanks,
    Manojo

  10. #10
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    minValue : Date/String
    The minimum allowed date. Can be either a Javascript date object or a string date in a valid format (defaults to null).
    Does this not provide the behavior you describe?

Thread Participants: 3