We have a scenario where we have multiple input textboxes, values are populated into those fields via physical reader machine. When the machine scans value it puts the value into the textbox a it simulates TAB key so it goes to another input textbox. But we want to verify the value in textbox (if null, or not valid based on DB) so we use validation triggerend by OnBlur event. If the value is okay, it goes on, but if the value is not okay we want to Focus on the element where the value was not correct (meanwhile focus went to next element) so if I implement this behavior on all input textboxes I encounter LOOP of focus jumping back and forth between elements. Any suggestions for this situation ?
Where does the simulated TAB key happen?
After scanning barcode and putting value into textfield
That’s when it happens, im asking where, like is it through a script or something like that.
nowhere, the physical scanner itself presses tab, we dont simulate tab anywhere (i dont know how to do it, even though I would like to)
You can’t trigger user-inputs. This is a browser security.
To prevent ‘looping back’ you can check in the onBlur if there actually is a value given at all.
If its empty make the value ok? Assuming the scanner doesnt send out nulls
If possible I would recommend configuring the scanner to not send a TAB key at the end of scan, instead use a different key code such as ENTER.
Otherwise, I’m not sure it’s possible to catch the tab event.
We are doing it, onblur there is a validation, but that does not stop cursor from jumping to next input before validation is completed
yes… onblur only triggers when focus is lost