4 Replies Latest reply on Oct 16, 2014 11:18 AM by Daniel Silva

    Problem with focus in Input Field with RhoBrowser on MK3100.

    Michael Schillinger



      we have a problem on MK3100 with RhoBrowser showing an pricefinder application - so simple HTML/Javascript website with one input field with autofocus set. The problem is, that the autofocus doesn't work for the MK3100, however the same website is used on MK3000 with iExplorer and autofocus working. So I see the difference in the browser.


      Website was created by our customer, using the following function for autocus.



      <input name="tbArticleNumber" type="text" maxlength="13" id="tbArticleNumber" onblur="theForm.tbArticleNumber.focus();" />


      <script language="javascript" type="text/javascript">

        // den Fokus in das Feld der Artikelnummer legen



      My question is, how would you suggest to set autofocus within Rhobrowser?




        • Re: Problem with focus in Input Field with RhoBrowser on MK3100.
          Jon Tara

          I'm not sure just what you mean by "autofocus". It's a new HTML5 feature:




          I don't think that's what you mean, though.


          What is it you are trying to accomplish, and how does it not work as expected?


          You have two bits of code above, and not sure which one isn't doing as you expect.


          1. You have some code (inline Javascript) that focuses a different field when tbArticleNumber is blurred.


          2. You have some code that I guess tries to focus tbArticleNumber initially.


          Which of these doesn't work?


          You need to wait for document ready before (2). You didn't say if you are using jQuery, so can't tell you how to wait for document ready.


          For (1) some browsers may require a timeout. I suggest not using inline Javascript.


          If you are using jQuery:


          $(document).on('blur', '.tbArticleNumber', function() {

          setTimeout(function() {



          (Unclear what you are trying to do here, though. You are changing focus back to the same field?)

          Note that the timeout value is 0. This should work for most/all browsers. This insures that the .focus() isn't attempted until after the blur event processing is completed.

          Actually, you can probably just use autofocus attribute:



            • Re: Problem with focus in Input Field with RhoBrowser on MK3100.
              Michael Schillinger

              Yeah, you are right - autofocus isn't the right function. Sorry for wrong terminology - I am not a programmer.


              What has to be achieved is that the focus should stay always on the same input field - actually the side has only one input field for barcode scanning.


              As said for the MK3000 with internet explorer 6 the customer website is working as expected - so focus stays always on the input field, even if you touch somewhere else on the screen. But the exact same website behaves different on the MK3100 with RhoElements Browser - the input field doesn't has focus on initial page load and if you touch somewhere on the screen, the field loses focus.

              (Unclear what you are trying to do here, though. You are changing focus back to the same field?)


              Yes, focus should always stay on the same field.


              I am not sure if customer is using jQuery. What would you suggest to use within Rhobrowser, that focus stays always on the same input field?

                • Re: Problem with focus in Input Field with RhoBrowser on MK3100.
                  Jon Tara

                  It appears they are using jQuery, based on the .focus() function, but, who knows? That's an awfully generic function name that could belong to any one of a plethora of libraries.


                  Did you try the things I suggested? I don't have anything else to offer. I know that the setTimeout() is needed for WebKit browsers, as those are the browsers I normally work with.


                  They should try a setTimeout() as I showed above. Some browsers allow to to set focus while in a blur() handler. Some don't. The thing is, the browser might change the focus after the blur callback returns, and so your attempt to set the focus is naught.


                  The proper thing is to always use the setTimeout().


                  As well, the initial focus needs to be done only after the DOM is ready. How you do that depends on what if any library - e.g. jQuery - is being used. Alternately, you probably can use the real HTML5 autofocus. But I'm not certain RhoBrowser supports that. It depends on what version of WebKit it's based on.


                  It's better to send your customer's developer(s) here than to try to interpret, IMO


                  Does your customer normally work only with IE browsers? I ask because I suppose it happens if you are only developing applications for in-house use and are a Microsoft shop. If so, I would make sure you emphasize that this is a WebKit-based browser, and they will have to adjust to that and learn how to do things in more cross-browser-friendly ways. It would be likely that they are (perhaps unknowingly) using or relying on many IE-specific quirks.


                  I doubt there is really any issue here specifically related to the RhoBrowser. You and they can probably test their website using Chrome on desktop, and I'd guess you will see the same symptom.

              • Re: Problem with focus in Input Field with RhoBrowser on MK3100.
                Daniel Silva

                Is there a reason you are using rho?  If you want it to work like the IE browser on the MK3000, you might have better luck using Enterprise Browser and selecting to deploy using IE instead of webit.  This should be equilvalent to running PocketBrowser.  It won't be exactly the same browser as the MK3000, but it would be more similar than the webkit browser in Rho or Enterprise Browser using Webkit.


                Also, if you are running any of our custom browsers (rho, PocketBrowser, Enterprise Browser) there are javascript APIs for the scanner that would allow the developer to capture the barcode scanned without needing a field to have focus (I assume that's why they are trying to do this).


                Enterprise Browser