We have chosen the Opera Mobile for one PDA application, everything went well until we hit a problem with regards to taking a scanned input to one of the text fields.
The general way you'd approach this problem is by setting one textBox to have focus when the scan operation is performed.
UNFORTUNATELY, intentionally or unintentionally Opera is not supporting this. The focus is no-where when you enter in to the screen and there is no way of explicitely setting it. Worst comes next, you cannot detect the key-press events too, which makes it virtually impossible to take the input event from the scan operation.
I have no clue why Opera, one of the best acclaimed mobile browsers, does not support this.
These are the places the same question is asked over and over again,
http://dev.opera.com/forums/topic/255066
http://dev.opera.com/forums/topic/650332
http://dev.opera.com/forums/topic/384311
We have posted in the Opera Dev forum as well and it seems that they (so far) have no solution for this. If anyone has tried a workaround, we would be interested to hear the solution.
And please note that the solution in here is not working in Opera Mobile 10. I have not tried it in the proposed 9.X version.
I found it myself. And here is how to do it.
Have a hidden button in the form
input type="button" id='myHiddenButton' visible='false' onclick="javascript:doFocus();" width='1px' style="display:none"
Have a javascript to get fired on the click event of the hidden button.
function doFocus() { var focusElementId = "MyTextBox" var textBox = document.getElementById(focusElementId); textBox.focus(); }
Have the button clicked using a javascript at the end of the document
function clickButton() { document.getElementById('myHiddenButton').click(); } setTimeout("clickButton()", 100);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With