Scan Inputs Using Opera Mobile 10

We chose Opera Mobile for one application for PDAs, everything went well until we ran into a problem regarding scanned input in one of the text fields.

A general way to solve this problem is to set up a single text box for focusing when performing a scan operation.

INCORRECTLY, intentionally or unintentionally Opera does not support this. There is no place in focus when you enter the screen, and there is no way to explicitly configure it. The worst part is that you also cannot detect keypress events, making it almost impossible to accept an input event from a scan operation.

I do not know why Opera, one of the most popular mobile browsers, does not support this.

These are the places that ask the same question 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 also posted Opera Dev in the forum, and it seems that they (so far) have no solution for this. If someone tried a workaround, we would be interested to hear the solution.

And note that the solution in here does not work in Opera Mobile 10. I have not tried it in the proposed version 9.X.

+6
source share
1 answer

I found it myself. And here is how to do it.

You have a hidden button in the form

input type = "button" id = 'myHiddenButton' visible = 'false' OnClick = "JavaScript: doFocus ();" width = '1px' style = "display: none"

You have javascript that will be launched when you click the hidden button.

function doFocus() { var focusElementId = "MyTextBox" var textBox = document.getElementById(focusElementId); textBox.focus(); } 

Click the button using javascript at the end of the document

  function clickButton() { document.getElementById('myHiddenButton').click(); } setTimeout("clickButton()", 100); 
+5
source

Source: https://habr.com/ru/post/886607/


All Articles