How to disable/enable keys |
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 (.) & backspace to be enabled & all other keys disabled. For simplicity is it possible to disable all keys then enable (0-9 . backspece) rather than individually disable all the others? Another example would be to enable only a-z lower case. Or A-Z upper case & maybe some others like @, #, $, %, &. 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. https://www.cambiaresearch.com/articles/...-key-codes I tried this coding but it didnt work, however we would like someting similar; PHP Code: <script> Please dont tell us to try HTML coz that doesnt work properly. In addition to disabling keys, is it possible to disallow by form_validation? Has anybody any answers or ideas? |
Messages In This Thread |
How to disable/enable keys - by christaliise - 02-07-2021, 05:27 AM
RE: How to disable/enable keys - by paliz - 02-07-2021, 12:14 PM
RE: How to disable/enable keys - by christaliise - 02-07-2021, 02:43 PM
RE: How to disable/enable keys - by brianjamestorr - 02-10-2021, 01:33 AM
RE: How to disable/enable keys - by christaliise - 02-11-2021, 12:23 PM
RE: How to disable/enable keys - by brianjamestorr - 02-12-2021, 08:26 AM
RE: How to disable/enable keys - by christaliise - 02-14-2021, 10:35 AM
RE: How to disable/enable keys - by christaliise - 02-18-2021, 07:15 AM
RE: How to disable/enable keys - by brianjamestorr - 02-25-2021, 08:37 AM
RE: How to disable/enable keys - by christaliise - 02-26-2021, 05:03 AM
RE: How to disable/enable keys - by christaliise - 02-27-2021, 06:13 AM
|