Skip navigation

Is there a work-around to programmatically set focus on form field in iOS/Safari mobile

4646 Views 23 Replies Latest reply: Dec 18, 2013 12:31 PM by etresoft RSS
1 2 Previous Next
LilyGE Calculating status...
Currently Being Moderated
Jan 15, 2013 2:50 PM

I would like to program iPod Touch 5's for use as scan guns, which means I need to be able to programmatically set the focus into a form field on page load. (My users do *not* want to have to touch the screen between scans.)


I've got the software working as a web app and styled for Safari mobile and Chrome right now, and I plan to re-write it in Sencha Touch 2. Unfortunately, it looks like Apple very deliberately keeps users from programmatically setting form field focus, and I haven't been able to find any work arounds or side-ways sidles into a solution.


Does anyone know a solution for this? Thanks!

iPod touch, iOS 6.0.1, Safari mobile or Chrome
  • etresoft Level 7 Level 7 (23,905 points)

    LilyGE wrote:


    Apple very deliberately keeps users from programmatically setting form field focus

    Perhaps an alternate explanation is that user hasn't bothered to search for answers on either the developer forums or Google.

  • etresoft Level 7 Level 7 (23,905 points)

    Sorry. I didn't notice you were talking about Safari. I saw scan gun and assumed you were writing an app. Apple had made a number of changes in Safari for iOS to make it work better on a low-bandwidth, touch-based interface. A web app probably isn't appropriate for this application.

  • etresoft Level 7 Level 7 (23,905 points)

    It is very rare to see any Apple product used in a business setting. When people are buying technology for themselves and every penny counts, they are more likely to buy Apple products. When millionaires are buying something that they will force other people to use, they are going to pay much more for over-priced junk because it comes with high support costs and kickbacks. If your market is business, target those Motorolas and join the local country club. If you really want to make something for an Apple device, add a "scan" button that uses a native control to process that input.

  • Michael Superczynski Level 5 Level 5 (7,105 points)

    "It is very rare to see any Apple product used in a business setting. "


    I'm very surprised to see this coming from you because this is no longer true.


    For example: 0-is-testing-and-deploying-the-ipad/

  • etresoft Level 7 Level 7 (23,905 points)

    I can only comment on what I have seen. I have not seen every fortune 50 company. I have seen iOS devices used in some specialty shops, but that's about it. I don't doubt that there are managment at bigger companies that get iPhones. In production operations - never. For most people, anything made by Apple is a second-class citizen in corporate IT.

  • Michael Superczynski Level 5 Level 5 (7,105 points)

    I know what you mean.

    I worked in corporate IT for 30 years and if I mentioned Apple or Macintosh I would get laughed at.

    I'm so glad I'm retired from all the BS.

    Now I make the IT decisions for my business and those decisions don't include the junk they use in the corporate shops.

    It's understandable why they are so resistant to Apple's products:  if they replaced all the Windows boxes with Macs running OS X, the staff could be cut by 90 per cent.

  • etresoft Level 7 Level 7 (23,905 points)

    I suggested using a Mac just a couple of years ago and actually did get laughed at. These same people recently installed a local version of some low-level open-source that didn't match the other libraries version and disabled 4 out of my 6 Linux servers. If only someone had tested that software and told them there was a problem. No, wait, I did that in August. Not to worry. We have a plan in place to fix the problem using virtual machines.


    Apple does not target this market for good reason. There are certainly some people, even in corporate IT, who know what they are doing and still buy Apple products. However, they must make do with what Apple sells for the consumer market and hack it up on their own. I would not suggest that anyone market a product for business users of Apple products. In those cases, purchasing decisions are typically made by old-school IT types.

  • etresoft Level 7 Level 7 (23,905 points)

    There is no law that says you must use a web browser with a web-based service. Ideally, all you would need is a stable REST URL to use with a POST request. An iPod will do what you need as long as you use the proper tools. It is true that having a scanner send input via a text field is an old-school, tried-and-true kludge, but it was never anything more than a kludge. Such things do tend to break when you change platforms. Why use Sencha Touch if you are only supporting one, HTML-based platform anyway?


    You could make a great inventory control system that works on any platform. Or you could kludge one up that works with one specific platform. With the kludge, you will save a few hours in up-front development costs in exchange for many cumulative hours of trouble during operations. I will leave it as an exercise for the reader to guess which option would be the choice for typical corporate IT.

  • T3kB0i Calculating status...

    We are currenty developing a web-app inventory management system with symbol bluetooth scanners. The original plan was to make them work with the client's existing iPads. Obviously it works flawlessly on any desktop browser, but it also works on WinMo 6+, Windows Phone, and Android. While aging, we gave it a shot to make it work on the iPad as well. After reaching a dead end with mobile Safari, this gave us a great reason to recommend the upgrade all tablets to Surface.


    I've been on dozens of threads, looking for a solution. Increasing production time by another month, and maintaining a seperate development cycle through an exclusively native iOS app is not worth our time, and is not what the customer wants.


    "A web app probably isn't appropriate for this application." - etresoft

    I disagree, we have deployed our inventory management web-app in many business with great success and user satisfaction, and mobile devices are a natural progression. While iOS is obviously a walled garden, jailbr3aking doesn't offer any solutions either. iOS is a sinking ship, the only solution is to jump boat to any one of the superior platforms.

  • Michael Superczynski Level 5 Level 5 (7,105 points)

    You have a problem with a web app on iOS thus "iOS is a sinking ship".

    Good grief.

  • T3kB0i Level 1 Level 1 (0 points)

    I'm not trying to start a flame-war with narrow-minded sheep. Your comment provides no benefit to users seeking for guidance and support.


    As you mistakingly suggest, the problem does not lie within the web-app. If you were able to read, you could see that our app doesn't have any problems. In fact, it works on every single platform. It doesn't work with iOS, that's why using logic (see: Vulcan) we can infer that the problem resides within iOS. See how we did that? =D It wasn't so hard, now was it?


    I am not expecting your intelligience to comprehend this problem from a developer's point of view. This is not a question about the iPads having poor battery life after an update, or something simple like that. This is an inherent flaw of iOS that has no "work-around" as the OP requests. Run along now and go back to playing Angry Birds on your iPad 4, the big kids are trying to get work done here.

1 2 Previous Next


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.