SOTI Surf - can content of an input field be directly overwritten with new scan?

CK

Hi community,

is it possible to set up Soti Surf in a way, that no matter if an input field already contais a string or not it is always overwritten by the next scan?

We use Zebra MC33X with the latest Android.

a year ago
SOTI surf
ANSWERS
MD
Matt Dermody Diamond Contributor
a year ago

Normally I would say that this would be a function of the web page itself as you'd need to have the web application set up so that it pre-selects any pre-populated data in fields with focus. With recent versions of MobiControl and SOTI Surf however they have introduced the ability to inject Javascript into the page so you could theorhetically insert Javascript to select any text that is pre-populated in a field that currently has focus. You could try inserting something like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Highlight Text on Focus</title>
    <script>
        document.addEventListener('DOMContentLoaded', (event) => {
            const inputs = document.querySelectorAll('input[type="text"], textarea');

            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.select();
                });
            });
        });
    </script>
</head>
<body>
    <input type="text" value="This text will be highlighted">
    <textarea rows="4" cols="50">This text will also be highlighted</textarea>
</body>
</html>

ZC
Zafer Cigdem
a year ago

Hi Christian,

I don't understand the question well. So, if you need more help in addition to Matt's response, can you please share with input field do you mention, is it the one above SS:

Do you want to do a new scan and then clear input field to fill it in based on the information from scanning

to visit?  

There are another Android JavaScripts as well. Here is the resources: Class: TextPromptDialog | Android Agent JavaScript (soti.net)

But this one shows you a text promt and then if you wish you can scan anything and list the scanning information here and save this informaiton or such, example is as below.

When you send out the example JS from the above link for example, it shows you this text prompt 

I hope this helps

S
SSMOD
a year ago

Hi Christian,


Thanks for posting on SOTI pulse. Thanks Matt and Rafer for responding to the post, your expertise and willingness to help are greatly appreciated!


Has your query been resolved? If not, or if you have any additional concerns, please don't hesitate to reach out. We are dedicated to providing assistance and support.


Also, if this post has helped you in solving your query, I would request you to mark the particular comment as "is solution", so that others may benefit from this information.