onEditCell onkeypress keycode always 0 in firefox

Hi,



Why is the keyCode always 0 in firefox below?

It works fine in IE.



function onEditCell_gridNumeroSerie(stage,id,ind,value)

{

if (stage == 1 && (ind == 1 || ind == 3))

this.editor.obj.onkeypress=function(e)

{ //editor area

var ValidChars = “0123456789.”;

if (ValidChars.indexOf((String.fromCharCode((e||event).keyCode))) == -1)

return false;//allow

else

return true; //deny

}

}

To make things “interesting” each browser use its own codes for the different keys.
You can change your code as
if (ValidChars.indexOf((String.fromCharCode(e?e.which:event.keyCode))) == -1)

Thanks it worked :slight_smile: