2 Replies Latest reply on Oct 27, 2011 8:57 AM by Alex Esquijarosa Chavian

    Enabling/Disabling decoders via JavaScript.

      Hello,

      I want to Enable/Disable certain decoders on the scanner using JavaScript. On the help file there is not clear the type of value this field accepts.

       

      Thanks in advance.

       

      Alex.

        • Re: Enabling/Disabling decoders via JavaScript.
          Benedict Kennedy

          Hi Alex,

           

          To enable or disable specific decoders with JavaScript in RhoElements, you need to set the field of the scanner javascript module to either 'enabled' or 'disabled'. Please note that these values are strings.

           

          Some examples:

           

          function enableWebcode()
          {
               scanner.webcode = 'enabled';
          }
          
          function disableCode128()
          {
               scanner.code128 = 'disabled';
          }
          
          function setupForMarketScanning()
          {
               //Disable some postal decoders
               scanner.ukPostal = 'disabled';
               scanner.japPostal = 'disabled';
               scanner.ausPostal = 'disabled';
          
               //enable some common decoders
               scanner.code128 = 'enabled';
               scanner.code11 = 'enabled';
               scanner.upca = 'enabled';
               scanner.code39 = 'enabled';
          
               //change some decoder settings
               scanner.code39FullAscii = 'true';
               scanner.code128maxLength = '20';
               scanner.code128minLength = '4';    
          }
          

           

          The scanner object will pre-exist on the web page.

           

          Thanks for the alert about the lack of JavaScript decoder examples, I have added a task to add these to all of the decoder entries in the help file.

           

          Regards,


          Ben