title: Detect Barcode Scanner on oracle apex
body: <p>Detect Barcode Scanner - using Javascript 
  <a href="https://apex.oracle.com/pls/apex/f?p=10355:32:21497051930136" rel="nofollow noreferrer">https://apex.oracle.com/pls/apex/f?p=10355:32:21497051930136</a>:::::
  user     : demo
  password : demo</p>
  
  <pre><code> $(document).ready(function() {
   var pressed = false; 
    var chars = []; 
    $(window).keypress(function(e) {
      if (e.which &gt;= 48 &amp;&amp; e.which &lt;= 57) {
          chars.push(String.fromCharCode(e.which));
      }
      console.log(e.which + ":" + chars.join("|"));
      if (pressed == false) {
          setTimeout(function(){
              if (chars.length &gt;= 10) {
                  var barcode = chars.join("");
                  console.log("Barcode Scanned: " + barcode);
                  // assign value to some input (or do whatever you want)
                  $("#P32_SCAN_BARCODE").val(barcode);
              }
              chars = [];
              pressed = false;
          },500);
        }
         pressed = true;
      });
      });
    $("#P32_SCAN_BARCODE").keypress(function(e){
    if ( e.which === 13 ) {
      console.log("Prevent form submit.");
      e.preventDefault();
     }
    });
  </code></pre>