4 Replies Latest reply on Apr 2, 2014 7:17 AM by Euan Torano

    Smart Badge user input

    Euan Torano

      I'm working on a simple app for the Smart Badge that requires the user to input the URL to a server application I've written that can be ran on any machine. I intended to do this using the JavaScript prompt() function as below:

       

          var host = prompt("Please enter the host for app.", ""),
              controller = new MyApp.MainController(".quiz", host);
      

       

      The prompt is displayed fine on the device, but you cannot actually input any information as the SB1 doesn't have a physical keyboard and no software keyboard overlay appears. A blinking caret does appear within the prompt box, but other than that it does nothing.

       

      Do I have to do something special to receive user input or is such a basic thing not possible?

        • Re: Smart Badge user input
          Euan Torano

          Ok, so I just found the asl.keboard() function while looking at asl.js and am now doing the following:

           

          HTML:

          <div class="setup"><input name="host" type="text" value="" /></div>
          

          JS:

              asl.keyboard("host", function(id, txt) {
                  alert(txt);
                  alert(id);
                  var quizController = new QuizController(".quiz", txt);
              }, "http://192.168.7.67/QuizApi", "Enter the host of the quiz");
          

          I would expect to see two popups after having entered text in the input and pressing the tick button, but instead nothing happens at all.


          Also, I just tested the sample application found in "SDK TSDxc60AenDT010200\Sample UserDrives\Full Sample User Drive\UserDrive\apps\app1" which uses similar code:

                  function kbd(){
                         asl.keyboard("number", function(id, txt){alert(txt);}, "123", "Keyboard Title");
                    }
          

          I press the "Kbd manually" option and a keyboard hsows. I input my text and the keyboard disappears - no alert is shown even though your callback tells it to alert the text Nice to see that it's not just me who can't get it working when sample apps don't work.

            • Re: Re: Smart Badge user input
              Daniel Silva

              I don't think you should need to call asl.keyboard.  If you have your input on the page, when the input box gets focus, the keyboard should come up automatically.  So you should be able to just have a page with 2 input fields and maybe a submit button.  If you are not seeing this happen, I'm wondering if maybe your asl.js might not be the most current one.  I will attach the one for OS36 here.  That will be coming in the updated toolbox, but I don't think that's posted yet.