Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   onkeypress form attribute only firing once (http://www.go4expert.com/forums/onkeypress-form-attribute-firing-t13015/)

dnewbury 18Aug2008 10:47

onkeypress form attribute only firing once
 
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!
dan

oogabooga 9Sep2008 04:15

Re: onkeypress form attribute only firing once
 
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.
Code:

<script>
function showKey() {
    window.status = event.keyCode;
}
</script>
<input size=10 onkeypress=showKey()>


Ryzer 1Mar2009 07:20

Re: onkeypress form attribute only firing once
 
onkeyup rather than onkeypress should work for realtime form validating


All times are GMT +5.5. The time now is 03:11.