1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

onkeypress form attribute only firing once

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

  1. dnewbury

    dnewbury New Member

    Joined:
    Aug 18, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Jan 9, 2008
    Messages:
    115
    Likes Received:
    11
    Trophy Points:
    0
    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

    Joined:
    Feb 15, 2009
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Pipeline Maintenance
    Location:
    Saskatchewan, Canada
    onkeyup rather than onkeypress should work for realtime form validating
     

Share This Page