Documentation :: Demo :: Tech Info
Form filling and auto-submit

WebBarcode can auto fill text inputs and submit the form they're associated with if the "Fill form text inputs" system setting is enabled.

To do so it'll first attempt to find a text input with class "webbarcode", then search for the first text input in the DOM.

If the text input is associated with a form, the form's "submit" button will be clicked or the form will be submitted if a submit isn't found.

The specific alogorithm that the app follows is (where 'scan' is the value of the barcode):

var input = document.body.querySelector('input[type="text"].webbarcode,input[type="search"].webbarcode');
if (!input){
    input = document.body.querySelector('input[type="text"],input[type="search"]');
if (!input){ return; }
input.value = scan;
var form = input;
while (form.nodeName != 'FORM' && form.parentNode) {
    form = form.parentNode;
if (form){
    var submit = form.querySelector('input[type="submit"]');
    if ( submit ) {;
    } else {
        var event = new Event('submit');