Moving from object to object with ENTER

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andersond
    New Member
    • Feb 2007
    • 110

    Moving from object to object with ENTER

    I know I can move from textbox to textbox with the Tab key; but, I would like to be able to do the same with the ENTER key. I have a form where some responses are in textboxes while others are in drop down boxes. With the drop down box I use an onChange event to make the next question visible and move focus to that next question. If the response is in a textbox I am using an onBlur event to make the next question visible and move focus to that next question. All is fine if the user knows to use the Tab key; but, if they don't it just sits there waiting for something to happen. What type of event handler should I use instead of onBlur to move on?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    why don't use the onchange event here too? this fires when the user has entered a new value into the textfield ... another option would be to use the keypress event where you might ask for the pressed key and proceed the way you need/want to ...

    kind regards

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      See http://bytes.com/topic/javascript/an...y-tab-keypress.

      Comment

      • xNephilimx
        Recognized Expert New Member
        • Jun 2007
        • 213

        #4
        I really don't reccomend doing that, users are used to press the tab key to change focus and enter key to submit (except for textareas), if you change that it'll result in a major usability issue.

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          good point ... even when i wouldn't say that will cause a major issue ... but certainly it is different from standard behaviour, but not that much. most forms try the submit on enter but validate the fields and focus the next one that needs correction ... or in most cases ... just need input. so in fact this common validation logic forces the enter to act as a tab key ... at least it feels that way.

          Comment

          Working...