1

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 == "")
{document.inputData.partNumber.focus()}
else
{document.inputData.workArea.focus()}
}

function check3()
{
var letters3 = document.inputData.partNumber.value.length +1;
if (letters3  <10)
{document.inputData.partNumber.focus()}
else
{document.inputData.quantity.focus()}
}
<%-- 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>
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by brynFlew
0

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

0

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 != "") {

                $('#workArea').focus();
            }

        });

    });

Edited by brynFlew: n/a

0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.