onkeyPress event in type input

Hi!
Could someone tell me how I reach the event “onKeyPress” in type input?
Tank you!

Hi,

you may define getInput method:

dhtmlXForm.prototype.items.input.getInput = function(item) {
return item.childNodes[1].childNodes[0];
};

and do the following:

myForm = new dhtmlXForm(…);

var itemId = “myinput”;
var inp = myForm.doWithItem(itemId, “getInput”);

inp.onkeypress = function(e){
/your code here/
}

This approach is for form 3.0. Let us know if you use 2.6 version

To Alexandra

Hello. I tried your code and It works well once leave the control.

When I press a key, data in InputBox is not changed.

How can I solve it.

Hi,

this solution was posted in 2011.

Current Form version provides onKeyUp event:
docs.dhtmlx.com/doku.php?id=dhtm … nt_onkeyup