1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

onkeypress form attribute only firing once

Discussion in 'Web Design, HTML And CSS Forums' started by dnewbury, Aug 18, 2008.

  1. dnewbury

    dnewbury New 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!
    dan
     
  2. oogabooga

    oogabooga New Member

    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()>
    
     
  3. Ryzer

    Ryzer New Member

    onkeyup rather than onkeypress should work for realtime form validating
     

Share This Page