I have this problem where I have created a User Control which mimics a keyboard to use on an application running on a touchscreen kiosk. The keyboard can be passed a regular expression and has an ‘Enter’ button that when clicked will validate the input, however I was wondering whether there is a way to dynamically validate the input as it is going in and disable certain keys dependent on whether it is a valid character for the next input.
To give some context, if I pass the keyboard the regex for a UK postcode, and the user has typed 2 letters, I would then like the keyboard to disable all other letters and only enable numbers etc.
Thanks in advance.
here is what I would try.
have an
onKeyUpjavascript function that checks the field for letters. if it contains the 2 letters then disable the letters with javascript and change the javascript function associated the enter button (let’s call this function CheckUKPostCode). In CheckUKPostCode you would validate for a UK PostCode. If the user starts out entering numbers the onKeyUp function would disable the letters and change the function associated with the enter button to USPostCode or whatever it is you need and then this function would validate the US Post Code