# onkeypress attribute

Type: | action
Inherited: | no
Used By: | input
See: | editable onchange type

The onkeypress attribute can be set on input elements of type "text", or "select" when editable is true, to run a specific action when a key is pressed in the field. This is commonly used in combination withe onchange to limit the contents of the field to a specific value - digits only, for example.

The input field is limited to digits only. This is done using two JavaScript methods that are built in to Acrobat

    <input type="text" name="amount" onKeyPress="javascript:AFNumber_Keystroke(2,1,1,0,'',true)"/>