# Switching to another text field component after pressing enter

**URL:** <https://forum.inductiveautomation.com/t/switching-to-another-text-field-component-after-pressing-enter/92397>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [June 26, 2024, 1:51pm UTC](https://forum.inductiveautomation.com/t/switching-to-another-text-field-component-after-pressing-enter/92397 "2024-06-26T13:51:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jmason/32/47301_2.png) [@jmason](https://forum.inductiveautomation.com/u/jmason)\
**Post date:** [June 26, 2024, 1:51pm UTC](https://forum.inductiveautomation.com/t/switching-to-another-text-field-component-after-pressing-enter/92397/1 "2024-06-26T13:51:56Z")

</div>

Hello  
I am trying to figure out a way to switch the focus from one text field to another after pressing the enter key. Is what I am trying to do even possible? I figured having some scripting in the propertyChange event would get me the results I am looking for, but I am unsure how to make it work. Does anyone have a suggestion?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [June 26, 2024, 2:04pm UTC](https://forum.inductiveautomation.com/t/switching-to-another-text-field-component-after-pressing-enter/92397/2 "2024-06-26T14:04:19Z")

</div>

It's simple:

```python
# written for the keyReleased event handler
if event.keyCode == event.VK_ENTER:
	event.source.parent.getComponent('Text Field 2').requestFocusInWindow()

```

Apply the script to the first textbox's keyReleased event handler, and just change `getComponent(Text Field 2`)` to the name of the text field that should receive focus next.

---

<div class="post-metadata">

**Author:** ![jmason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jmason/32/47301_2.png) [@jmason](https://forum.inductiveautomation.com/u/jmason)\
**Post date:** [June 26, 2024, 2:13pm UTC](https://forum.inductiveautomation.com/t/switching-to-another-text-field-component-after-pressing-enter/92397/3 "2024-06-26T14:13:34Z")

</div>

Thank you, works exactly how I need it to!
