TC25 keystroke output not raising javascript keypress event

M Martin Stephenson 2 years 11 months ago
181 2 0

I'm trying to capture barcode data from the internal scanner on HTML5 page without an input field to prevent the android keyboard popup.

The code works perfectly on our TC51, but the keypress event is not fired on the TC25.

The Datawedge configuration is the same on both devices. 
TC51 Datawedge v6.6.47

Keystroke output : Enabled
Action key : none
Advanced data formatting, Basic data formatting : Disabled.

The following event has been added to the page

    document.addEventListener("keypress", function (e) {

        if (e.target.tagName !== "INPUT") {
            $("#barcodeInputHidden").val($("#barcodeInputHidden").val() + e.key);

            $("#barcode").append(e.key);
            if (!barcodeTimerRunning) { barcodeTimerStart(); }

            e.preventDefault();
        }
    });

    function barcodeTimerStart() {
        barcodeTimerRunning = true;

        setTimeout(function () {
            var barcode = $("#barcodeInputHidden").val();
            evaluateBarcodeInput(barcode);

            console.log('barcode : ' + barcode);

            $("#barcode").html("");
            $("#barcodeInputHidden").val("");

            barcodeTimerRunning = false;
        }, 500);
    }

Please register or login to post a reply

2 Replies

B Bastian Fellner

We experienced the same problem but even within the same model (both TC25).
One device would simply not output any characters.
DataWedge Version is 7.0.4 on both devices.
Solution:
The faulty scanner works if within the active DataWedge profile the "Delay between characters" value in the "Keystroke output" section
is set from the default of "0 ms" to a value > "0 ms" (e.g. 1 ms).
(We are running a German firmware on the devices - so I am guessing the correct English labeling here).
We also noticed differing versions of the "2D Barcode Imager" (*-R03=ok; *-R01=not ok)
Happy Holidays!

A Anders Grandt

Did you find any solution to this?

CONTACT
Can’t find what you’re looking for?