
Hi Power Apps Community,
I'm currently working on a Power App where I want to trigger a specific action, like navigating to the next screen, when the Enter key is pressed in a TextInput field. However, I've noticed that while the Tab key works as expected (jump to another TextInput field), the Enter key doesn't seem to trigger the intended action.
Here's the relevant part of my code:
If(
!IsBlank(TextInput1.Text) &&
Code(TextInput1.Text) = 13, // 13 is the Unicode value for Enter key
Set(varABC, true);
Navigate(NextScreen)
)
The issue I'm encountering is the action is not triggered.
I've researched and tried various approaches, but none seem to work as expected. Can anyone in the community provide guidance on the correct way to capture the Enter key press event in a TextInput field and execute a specific action?
Thank you for your assistance!
Hi @Anonym_2 , On change property should work for you --- the OnChange is only actioned after the user has changed the text input and then tabbed, entered or clicked out of the text Input .
If(
!IsBlank(TextInput1.Text) && Code(TextInput1.Text) = 13,
Set(varABC, true);
Navigate(NextScreen)
)To make sure that user does not add empty string in text input control, that is reason we use Trim function to make sure that any blank string is removed.
NOTE: Not sure about Code(TextInput1.Text) function that you used in the above code.
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB