Onchange and Onsubmit called simultaneously when Enter key is pressed in Mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sourav08
    New Member
    • Jul 2008
    • 10

    Onchange and Onsubmit called simultaneously when Enter key is pressed in Mozilla

    hi,

    I'm facing a problem in Mozilla which is ok in Ie.

    I have few input boxes in my page. After entering some text in one field and pressing the enter key, Onchange event is called for every wrong input and cursor goes back to re-enter the text. In Mozilla when enter key is pressed it first called the onchange event and then simultaneously calling the onsubmit function written in Javascript. In IE it is not throwing the onsubmit event before going to the next field unless it is the last field of the page.
    What is the problem in Mozilla?

    Please suggest necessary soultion.

    Regards,

    Sourav
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    The enter key can trigger submission. You can capture the event and set the focus to the next field instead (rather give it a tab behaviour).

    Comment

    Working...