Open ctasada opened 12 years ago
[jhulford] @gwt.newsgroup The way I do it in my date/time textbox (which is more like Jens' suggestion, one textbox for date and time) it to just allow the user to type any numeric values in there and I evaluate every keydown and examine the context which the number is being entered. ie. does entering a 3 after the 9 in 9:30 make sense? No. Disallow. etc. Then evaluate the full string on focus lost if you're implementing value change handlers. It does lead to a bit of validation code and some pains handling highlighted text and key value differences between browsers, but, in my mind, it's a better user experience.
Both previous issues mainly solved.
What's left now is:
[Jens] @gwt.newsgroup 1.) when I click into any of both text boxes you should preselect all its contents (like its done when focusing the textbox using TAB) so I can start typing a new hour / minute. I don't want to select it myself using the mouse or hit backspace 2 times before I can change hour / minute if its not "00". 2.) it would be nice if the focus switches from hour to minute automatically if I have typed two digits into the hour box. 3.) The PM/AM behavior seems strange. 15:00 AM doesn't make sense. If AM/PM is visible, hour should only allowed to be 0-12. 4.) What if the time value being shown is optional? I can't delete all the contents to get a "null" time (thats why I prefer a single box for TimeBox. I don't want that hardcoded ":" between empty fields and also deleting a time is easier: CTRL + A => DEL in a single box).