We would like to learn how to disable/enable keys for within a text box, with coding as simple as possible.
For example in a text box that provides a decimal measurement we would only want numbers 0-9 & period (.) to be enabled & all other keys disabled.
For simplicity is it possible to disable all keys then enable (0-9 .) rather than individually disable all the others?
Another example would be to enable only a-z lower case.
Or A-Z upper case.
Another idea we have is to disable these characters < > { } from all text boxes & text areas, and also record the users ID, together with a warning message, of whoever attempts to insert those characters.
We are familiar with the Javascript Char Codes (Key Codes) but wonder if the numbers are consistent.
And have read that some browsers use different numbers. Is there any truth in that?
If different browsers use different numbers then it would be appropriate for the website to enable the browsers that are consistent with Javascript numbers.
Another concern is, as Javascript is client side coding, can it be hacked to circumvent any disabled keys?
I read this in an article - There is NO security in html forms. The form exists in the user’s browser, and by definition the user has complete control over what’s in their browser. Im not sure if that considered the disabling of keys.
@RandellDawson you appear to know a little Javascript. Maybe you can help. Or has anybody else any answers or ideas?