Problem with onKeyPress Event and keycode

Hello,

I use a French keyboard. That can be simulated using windows setting , adding French keyboard layout.
I try to test a numeric character entered in a text view component. Then I use the onKeyPress Event.
But I can not catch the correct key code value for numeric char, and other char also.(All are in lowercase). Can you explain me what happens ?
Here is the dhx code :
dhx.extend($$(“text_id_”), dhx.KeyEvents);
$$("“text_id_”).attachEvent(“onKeyPress”,function(code, ctrl, shift, evt){
var unicode = code; // evt.charCode ? evt.charCode : evt.keyCode;
alert(“ctrl :” + ctrl);
alert(“shift :” + shift);

	if (unicode != 8){ //if the key isn't the backspace key 
		if (unicode < 48 || unicode > 57){ //if not a number
			alert("not a number :" + String.fromCharCode(unicode));
			return false;
		}
		if ( (unicode >= 48 && unicode <= 57) || (unicode > 93 && unicode <= 105) ){
			alert("a number " + String.fromCharCode(unicode));
				return true;
		}
		return false;
	}
});

I have test the code, using directly HTML code : I get the correct key code.

Html code :

[i]

<script type="text/javascript" charset="utf-8">
		<!-- awsui_buildUIApp(); -->
	
		function checkKey(e){
		var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode != 8){ //if the key isn't the backspace key (which we should allow)
		if (unicode < 48 || unicode > 57){ //if not a number
			//$$("latitudeDegree_").define("css",".aws_error");
			
			alert("not a number : " +  String.fromCharCode(unicode));
			return false;
		}
		
		if ( (unicode >= 48 && unicode <= 57) || (unicode > 93 && unicode <= 105) ){
			alert("a number :" + String.fromCharCode(unicode));
				
				return true;
		}
		//$$("latitudeDegree_").refresh();
		return false;
}
}

</script>
<form>
	<input type="text" size=18 onkeypress="return checkKey(event)">
</form>
[/i]

code parameter calculated as

var code = e.which||e.keyCode;

you always can revert back to native event object.
Also, the handler actually fires on dom-keyup event ( done in such way to catch special key events ) which may cause the difference.

The problem remains the same

using :
var unicode = evt.which ? evt.which : evt.keyCode;

I am using FF 10 and Windows 7

Hi Stanislass,

I have not succeed the method you notice.
Do you have some feed back with this open point ?
I am really blocked