In a JSP I have two fields. When the page is loaded, the focus is set to the first field. When I input the value from a barcode reader, it "presses" the enter key so the form is submitted.
I need to use the barcode reader to input the first value in the first field, then focus the second field so I can scan the second value and only then submit the form.
The javascript function I'm trying to use is this:
$().ready(function() {
$("#serialNumber").val("").focus();
$("#serialNumber").keypress(function(e) {
if (e.which == 13) {
$("#serialClient").val("").focus();
} else {
$("#button").submit;
});
}
});
The form submit button is:
<button type="submit" class="submit">Submit</button>
But if I change this button type to "button" I can submit the form any longer.
How can this be fixed?
Thanks in advance,