onkeypress form attribute only firing once

dnewbury's Avatar, Join Date: Aug 2008
Newbie Member
I want to do realtime form validation. I have a form input tag with the onkeypress attribute. Like this onkeypress="isNewName();" It appears to call the isNewName function, but it seems to be only firing once. How can I make fire with each keystroke entered? Thanks for your help!
oogabooga's Avatar
Ambitious contributor
This seems to fire every keypress. It displays the keycode in the status bar.
If your code still doesn't work, you'll have to post it.
function showKey() {
    window.status = event.keyCode;
<input size=10 onkeypress=showKey()>
Ryzer's Avatar, Join Date: Feb 2009
Go4Expert Member
onkeyup rather than onkeypress should work for realtime form validating