The problem was with a software I wrote in PHP for the previous company I used to work, a user bought a bar code reader and wanted to use it with the software, but the stupid bar code reader sends an "Enter" key after it reads the bar code, so the software submited the form and the user got really pissed.
Anyway, the solution was this piece of code:
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
function SendTab(objForm, , strField, evtKeyPress)
var aKey = evtKeyPress.keyCode ?
evtKeyPress.keyCode :evtKeyPress.which ?
evtKeyPress.which : evtKeyPress.charCode;
if (aKey == 13)
objForm[(getIndex(objForm[strField])+1) % objForm.length].focus();
I found most part of this solution on google and just adapted it to my needs, sorry about not giving the credits to the author, but I got pieces of code from a lot of places and can't find them again, if you are the author of some of this code, please let me know.
To use it, just put this on your input code:
onkeypress="return SendTab(document.forms['f'], 'yourfieldname', event);"
It will process the "Enter" key as a Tab and go to the next input.