i have created a php application where am using a barcode scanner to load item name and prices from database. the problem is that once the barcode reader finishes reading the barcode, the details are loaded and it tabs to the next field. this means that the user has to click again on the barcode field to ficus it. how do i prevent the cursor from focusing the next field after scanning i.e focus again and again on the barcode field only for faster selling of items ?

give the barcode box an id of "barcodeBox"

then as the barcode reader finishes use this javascript:

document.getElementById('barcodeBox').focus();

If it's not ran using javascript, add in a fake input box just after the barcode that has no use, and give it an onfocus script eg.

<input type="text" style="height:1px;width:1px;" onfocus="document.getElementById('barcodeBox').focus();"/>

so soon as it tabs it will jump back

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.