# Use scanner change from one text input to another

**URL:** <https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [May 15, 2020, 9:50am UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773 "2020-05-15T09:50:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 15, 2020, 9:50am UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773/1 "2020-05-15T09:50:11Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7a76335c80ed1b6c381720d0e0a68c196b294474.png)  
i have a project that will use scanning gun to scan the barcode  
after the scan the data, it will have enter and line feed,  
i want to know how to after success scan the data to the upside text-input, then it will automatically change to the downside text input, i will no need use the mouse to move to that position, use which scripting? thanks a lot

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 15, 2020, 12:09pm UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773/2 "2020-05-15T12:09:54Z")

</div>

You could add a property change event script on the top field so that when the text property changes, it writes the text into the bottom field?

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 15, 2020, 12:51pm UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773/3 "2020-05-15T12:51:26Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4061bd08499a5783804d8ad0b624c7ca0dc0d42a.png)  
for example, if i have 3 text input  
if i want to write the message in text input 1, i should first use mouse click the text input1.  
after i write the data, i want to write the data for second input, i should the mouse click this position , or use Tab of the keyboard  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/bb7743df9883e37e9e06016309bc0b004ee20ca6.png)

is there any scripting , if the property changes, it can works as a tab function , enable me directly write the data to the second input, no need keyboard or use mouse to click

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 15, 2020, 1:08pm UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773/4 "2020-05-15T13:08:36Z")

</div>

Ah, I see now. Yes, you can add a property change event to the top field to check for when the text changes, and then you can use `grabFocus()` to move focus to the 2nd field.

E.g.

```auto
If event.propertyName == 'text':
    event.source.parent.getComponent('textfield2').grabFocus()

```

Make sure your text fields have defer updates options checked

(see available methods/properties from the [javadoc](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/index.html) for `PMITextField` for where `grabFocus()` came from)

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 16, 2020, 1:11am UTC](https://forum.inductiveautomation.com/t/use-scanner-change-from-one-text-input-to-another/34773/5 "2020-05-16T01:11:44Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4f7839ded1997b09c85d726137f30ba263795cc2.png)  
thanks for your support , it works, it will be very easy for my operator just use scanner to switch to another text input, make life easy 😀 😀 😀
