At one point, I had a customer who wanted an entry field that would validate a time of day (HH:MM:SS); actually, since the application was for video processing, the time also included a frame count within the second, but that's not really relevant to the discussion. The customer found "validate-on-focus-out" to be unacceptable: he wanted the field NEVER to have invalid content. What the customer (and, surprisingly, the users) actually liked was to put a sample time in the field, and set up the keyboard bindings to function in overtype mode. The key bindings got to be a bit complicated, since they were dependent on the location of the entry cursor.
Here's the code, in case anyone else finds the idea useful:
(ugh, I've found that it's too big for my browser to accept in the text area. I promise to find another place to put it.)
RS is happy again that he likes tiny code snippets which fit between thumb and index finger..;-)
MG has some similar code on the timeentry page. It really should highlight the next character, come to think of it, to show that it overtypes, but otherwise works nicely (so far as it's been tested). It's about 100 lines long, and works in a spinbox (though if you only wanted an entry field, you could cut out about 60% of the code which is specific to the spinbox buttons).
Also see timeentry.
The timefield widget only supported "HH::MM" but was only about 100 lines long. If anyone is interested, I could post it here on this wiki.