ENTER to TAB redirect problem: submit form at the end of cycle
<p>I'm using this jQuery function to jumping on "input" styled components of the form: </p>

<pre><code>$('*').live("keydown", function(e) 
{    
  var inputs = $(this).parents("form").eq(0).find(".input:visible:enabled"); 
  var idx = inputs.index(this); 

  // ENTER IS PRESSED
  if (e.keyCode == 13) 
  { 
    if (idx == inputs.length - 1) 
    {
      inputs[idx + 1].select();
    } 
    else 
    {                           
      inputs[idx + 1].focus(); 
      inputs[idx + 1].select();
    }
    return false;
  }
  // TAB IS PRESSED
  if (e.keyCode == 9) 
  { 
    inputs[idx + 1].select();
    return false;
  }
});
</code></pre>

<p>and this components on the form (reduced code):</p>

<pre><code>&lt;h:inputText id="persId" tabindex="1" styleClass="input"&gt;
&lt;h:selectOneMenu id="type" tabindex="1" styleClass="input"&gt;
&lt;h:selectOneMenu id="no" tabindex="1" styleClass="input"&gt;
&lt;h:commandButton type="submit" tabindex="2" id="btnSubmit" styleClass="btninput"/&gt;
</code></pre>

<p>what I need is to jumping on 3 inputs and after that submit a form (using Enter). When I replace selectOneMenu by inputText, it works fine, but with selectOneMenu, it doesn´t.</p>

<p>TAB rotate all three components normally. </p>

<p>What am I doing wrong?</p>

<p><strong>UPDATE:</strong> perhaps it would be enough to fire enter normally <code>if (idx == inputs.length - 1)</code>, but I don´t know how..?</p>

<p><strong>SOLVED:</strong> aha, it's simple, just add <code>document.getElementById('food:btnSubmit').click();</code> :)</p>
