In a perfect world I would be able to stop the user from entering a character in a textbox on a asp.net page if it was not the next expected character in the specified date format.
For the format: dd-mm-yyyy if a user were to type “22” followed by anything but the “-” nothing would happen.
Is there a way this is possible using javascript, I have validation currently that checks the dates for the correct format, but this only occurs on a button click.
In this scenario all users will know the correct format, and should only ever be caught out when making a mistake, which this method should quickly (instantly) rectify.
If you are ready to use jquery then you can use
date mask plugin
http://plugins.jquery.com/project/DateMask