Scroll

How to disable input on the Numeric Keypad

How to disable input on the Numeric Keypad

Follow
Summary This article describes how to disable the use of the NumPad on a standard 107-key keyboard
Applies to askiadesign
Written for Scriptwriters and Survey Authors
Keywords disable; number; script ; keypad; numpad; java; design

 


This function will allow survey programmers to disable the use of the Numeric Keypad using Javascript.

This will work for Web, CATI (web screen), and Face (web screen).

 

Survey Layout

First, ensure that you have the option Use web screens in VOICE/FACE enabled on your screen group:

 

Please note this function will not work if this option is not enabled.

 


 

Implementation

Now that you have enabled Web screens in your CATI survey, input this following Javascript at the end of "Head" in Internet Settings:

 

<script type="text/javascript">
document.onkeydown = function (e) {
  if (e.which >= 96 && e.which <= 105) {
    return false;
  }
}
</script>

 This script as currently written will only disable keys 0 - 9 on the Numeric Keypad (codes 96 through 105). If you want to disable more than that, you can find other keys and their corresponding codes here.

 This function, when enabled, will not accept input from the Numeric Keypad for Coded, Numeric, Open Ended, and Date questions.

Have more questions? Submit a request

Comments

  • Avatar
    Dean Howlin

    hi
    i tried below in askiaface "use WEb screen for Voice/Face" mode but it did not disable the RETURN key. is this possible?

    document.onkeydown = function (e) {
    if(e.which ==13){
    return false;
    }
    }