3 Apr 2008 8:55 AM #1
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.
3 Apr 2008 9:14 AM #2
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.
15 Apr 2008 10:57 AM #3
15 Apr 2008 11:47 AM #4
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.
15 Apr 2008 12:05 PM #5
OK. We already have server-side validation to check that dates are within a valid range.
15 Apr 2008 12:41 PM #6
DateField does have config properties for minDate and maxDate, as well as disabledDays and disabledDates, and of course support for custom validator functions...
18 Apr 2008 4:58 AM #7
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 ?
18 Apr 2008 7:35 AM #8
The datefield itself respects the validation functions the same as any other field does; marks itself as invalid.
23 Apr 2008 8:44 AM #9
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?
23 Apr 2008 11:35 AM #10minValue : Date/String