DISABLING KEYS USING JAVASCRIPT IN APEX
Application customization, by using JavaScript “Key Disabling” can be achieved, thereby preventing the user from feeding the particular key input value into the system. It restricts the characters which need not to be entered into a particular field in a Form or Report column. To disable a key, follow these steps: Step 1: Creation of JavaScript Function Create the following JavaScript Function in the page HTML Header Region. Source Code: <SCRIPT language=JavaScript> <!— function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } //–> </SCRIPT> Step 2: Calling the JavaScript Function Call the JavaScript function on the particular Report Column/Field in which the Keys has to be disabled. onkeypress=“return isNumberKey(event);” (Or) onclick=“return isNumberKey(event);” OUTPUT: The Input Key does not work in the field where the JavaScript function is called, provided if the Input Key code falls between the char-code entered in to the JavaScript function.
Read More