Hello,
Thanks for your feedback.
I am providing you a copy of our scope agreement for your issue.
It always not that easy to sell the message about the design limitations of our product Dynamics NAV.
But we have to handle limitations and boundaries and this s on of them so I hope you at least appreciate that we can give her a clear and solid answer about the problems and limitations which comes with this.
Issue Definition:
You are running NAV 2017 with the build 15601 from CU 4 On the NAV 2017 Phone/Tablet Client, after barcode scanning, the barcode field automatically looses it’s focus after barcode scanner’s keystroke. This behavior does not exist on the RTC, so the customer can do serial scanning.
Hence, we need a solution to keep the cursor and the focus on the barcode field after barcode scanning for a customer to streamline their barcode scanning process.
Scope Agreement:
The case is considered as resolved when we clarified the current design on the NAV App and if your plans can be accomplished with the current design of the NAV app.
We got this question a lot of times in the past and we discussed this with the product team.
Currently your reported behavior is the intended design of the NAV app.
“We intentionally do not set focus to the first field on touch devices, because this always results in the soft keyboard appearing. This could be on a phone, tablet or hybrid mobile device. This is a conscious decision based on user studies, where we see the soft keyboard is distracting and space-consuming upon entering the page, especially given that most users still need to swipe to locate the field they would like to edit. In most cases it also results in having to press the Back button twice to exit the page.”
We reported this problem as feature change request and this is still open as deliverable by the development to have this maybe with a special configuration switch added to control the behavior for the future versions but there are no short terms to have this working.
But for now and the current versions this is not possible.
Best Regards,
Sebastian
Answers
2. I'd say an add-on using javascript should be possible to set the focus if required. It is certainly a lot more complicated, but assuming you can set it up to call
document.getElementByID('Barcode Box ID').focus();
at the end of your routine for processing the barcode that should solve your focus issue.
On a different note, I find this to be a horrible choice and the original behavior should really be made an option.
Thank for you advice. I am a bit new to development side, which variable should i use in order to use document variable. Because you can not use any ".net" objects on mobile clients. If it should be an add in which deployed to server side, can i find it on internet?
There's a brief walkthrough from MS on this. There's a few videos and blogs too.
I was wondering if the OP had resolved their issue? We have implemented a "control add-in" using similiar javascript, as per Barandeniz's suggestion, to keep focus on a "scanning entry" field in the mobile APP. It works well in most browsers and on Android devices... it is just not supported on IOS devices. Any one had any luck with autofocus on an iPhone/iPad?
Thanks for any suggestions...
Hi Tim,
wondering if you could give me a hint how you handled the the control add-in to focus the first or any specific input field?
I created a control-add-in with javascript, and added it at the end of a test page.
The script looping through all document forms, skipping hiddens forms, to focus on the first element.
When running the script on a test html page, it's working.
Unfortunatly it's not working within the nav webclient context.
Dont't know how to get the input field id, as it seems to be assigned dynamically.
Are you testing on an actual mobile device? If i remember correctly I think the focus would not work for us in a windows web browser for example. It worked on a windows or android mobile device (not iphone!) with the NAV app or a web browser on that device.
We could only get one field to be set in focus, so we could only have one scan field, at the top of a page for example, that was set with the "focus" control-add in.
I hope this helps.
Cheers.
i tested on several web brower using the phone client view phone.aspx, due to lack of a testdevice at the moment.
i will test it tomorrow within the nav app.
but i'm afraid that my approach is maybe not the right one, looping through all elements to focus the first non hidden one.
but when i try to access the field directly with something like this seemed not to work:
document.getElementByID('MyBarCodeFieldID').focus()
The documentID seems not to be the name or id of the nav field.
or maybe the add-in is firing too early before receiving all document elements.
can you give me a hint how you passed the elementid of the scan field to the focus control-add in?
maybe a code snippet?
cheers
Looking at our solution again... maybe it's not entirely what you are looking for.
We used javascript to insert a single "scan box" field into our NAV page. This then we could control and have focus set to it. The single "scan box" then controls all operation of that page.
If it helps... our code and setup is below. Please excuse me but once I've worked on anything "fancy" outside of NAV i soon forget it!
From what I remember (and i'm sure we followed the examples given in previous posts)... this is what we have working in NAV2016 and NAV2018:
Our .Net code is, which produces the dll you add to you "add-in" service folder :
Then you need the "resources" zip file that you import against your "control add-in" record in nav.
The zip file contains the:
Our javascript is:
Our manifest.xml file:
Our stylesheet.css:
As said, we added our "control add-in" setup:
Then in the page design we have one field that is using the ControlAddIn (2) that will have focus. We have another field (1) that is a normal NAV field that we use when we are not running the page from the webclient.