Hello, I have a barcode scanner and when a field is scanned it should autotab to the next field for population. I have tried this before but cannot seem to get it to work the way I would like. It should auto tab if the field in not null, i have tried this code but cannot seem to get it working unless it is using a fixed size. f3 works f2 doesn't Thanks.

function check2()
var work = document.getElementById("workArea"); 
var letters2 = document.inputData.workArea.value.length +1;
if ( letters2 == null )&&( letters2 == "")

function check3()
var letters3 = document.inputData.partNumber.value.length +1;
if (letters3  <10)
<%-- work area --%>
<p style="text-align:left;margin-top:-10px;">Part#:&nbsp;<input type="text" id="partNumber" name="partNumber" property="partNumber" onKeyUp="check2()" value='<%= form.getPartNumber() %>'/></p>

Recommended Answers

All 4 Replies

In line 5, you are expecting an element with name "workArea" but you are calling check2() with it? Where is your "workArea" element?

i didnt add all the code here just a sample of what im trying, also i edited it to call that so i didnt have to paste all my code so some is prob wrong. i tried this as well but it does the same thing basically and it seems the scanner inputs chars one at a time so when i use this code it puts one char then autotabs to next field and puts one char there and so on.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript">

    $(function () {

        $('#swipeCard').keyup(function () {

            if ($(this).val().length != "") {




If it reads 1 char at a time, then in your check for the onkeyup, check if the length of the value in the field is long enough to go to the next field. This, of course, assume that each barcode has exactly the same length.

However, if they aren't the same, you need to find the similarity of all barcode and form a set of possibility to check. Then use the set to determine whether it should go to the next field.

Hope this would give you some idea.

I was able to configure the barcode scanners themselves to do this automatically by doing this. I used an ikon 8738.

Open up the Teklogix Scanners applet
Move to the Translations tabulation
Expand Case 1
Double-click No rule
Select Add barcode prefix/suffix
Click the Suffix edit box
Click [ Insert Key ]
Press the TAB key, then click [ OK ]

Press [ OK ] to save the new settings

Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.