# Want to switch from one text field to password field by pressing enter

**URL:** <https://forum.inductiveautomation.com/t/want-to-switch-from-one-text-field-to-password-field-by-pressing-enter/107858>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 26, 2025, 5:33pm UTC](https://forum.inductiveautomation.com/t/want-to-switch-from-one-text-field-to-password-field-by-pressing-enter/107858 "2025-06-26T17:33:24Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 28, 2025, 11:07pm UTC](https://forum.inductiveautomation.com/t/want-to-switch-from-one-text-field-to-password-field-by-pressing-enter/107858/7 "2025-06-28T23:07:57Z")

</div>

> [@owaisurrehman786](#):
>
> `self.parent.parent.getChild("FlexContainer_0").getChild("passwordField").focus()`

This sort of code breaks if you ever move components in and out of containers or rename them.

Consider using `sendMessage()` instead and adding a message handler on the target field to set focus on itself. This is a practice worth adopting and whoever has to maintain your code will appreciate it.

Also, please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

_[View the full topic](https://forum.inductiveautomation.com/t/want-to-switch-from-one-text-field-to-password-field-by-pressing-enter/107858)._
