Javascript and barcode

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monotreme
    New Member
    • Oct 2006
    • 1

    Javascript and barcode

    I have a form one input. If you set it up with onchange="somej avascript...."
    and you type into the input field it does the javascript. If you scan a barcode
    into the input box it doesn't trigger the javascript. onkeydown onkeypress or onkeyup will trigger it, but they are incorrect because they fire before the data
    gets in and the javascript thinks there's no data. I tried a setTimeout where it would wait 50 usec before it fired the javascript, in the hope that that would give the data a chance to get as the value. but that didn't get it either. I also tried an input all by itself outside of form because I really don't want to submit this to server the old fashion way. my javascript is ajax actually so I get some asynchronous serverside action. I cant believe no one has a barcode reader trigger script for javascript.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You could use setInterval to call a function to check the input element at regular intervals. If it's different, fire the onchange function.

    Comment

    Working...