8 Jun 2012 2:34 PM #1
Unanswered: Form field loses focus despite forcing focus on the field on several events
I'm creating a barcode scanning app which will use Bluetooth opticons to scan a barcode and store locally the id that this contains.
The scanner is simply just a keyboard emulator but a clever feature for the iPad is that it hides the keyboard for you.
At some point this action is causing my form field to lose focus despite me putting in listeners all over to catch blur from the field and re focus it, blur from the container and then refocus that.
The idea is that quick scanning can occur and store the id's scanned so this loss of field focus slows down the focus of the app. If i type normally using the ipad keyboard this is fast and refocus on the field once scanning has occured.
I have set an onkeyup event listener which listens and saves at the point that the form value is 7 digits long. This is all fine, this saves and also refocus on my field so my theory is that there is something going on with the special keyboard hiding feature that these scanners provide.
I just wanted to see if anyone has experienced anything similar at all and found a solution or can think of ANYTHING at all that i could try as i'm running out of ideas.
Thanks in advance
10 Jun 2012 10:06 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
Is the scanner tabbing to the next field to blur? Mobile devices really don't like being told to focus on a fieldMitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
11 Jun 2012 2:00 AM #3
It's a strange one, there is only 1 field on the page, the issue seems to be around how the scanner is able to force the keyboard to hide on the device.
I have put some console logging in place in my blur and focus listeners and these work fine when i'm typing with the keyboard,there is a listener on keypress in the field which stores after 7 digits is hit, focus is always forced back into the text field without any problem.
When i use the scanner and the keyboard is hidden focus initially goes into that field fine, however once i've scanned it hits seven, stores and then just sits there without the field having focus, in the error log my debugging message for field focus is there, almost like the field has focused and then something else has happened but the fields blur has not realised.
I am going to have a play without the seven digit rule and see if the focus is lost after a scan still or sits at the end of the scanned code.
I have noticed the same if I click on error log, the field loses focus, however in the log its not displayed my blur listener debugging message.
I'm still playing so will post if i find anything else. I'm going to try some keypress listeners to force back into the field when a keypress is detected within the container see where i get to with that.