Skip to main content

Notifications

Community site session details

Community site session details

Session Id : OxrnVf7AR/qqnxIwhG6qpq
Power Apps - Building Power Apps
Answered

How to trigger an action when Enter key is pressed in a TextBox

Like (0) ShareShare
ReportReport
Posted on 22 Feb 2023 14:59:56 by

Hello everyone, 

I got a TextBox and i want to Patch() this value when I click on the Enter key while I'm on the TextBox.

For the moment the Patch() function occur when I click on the button "Retirer" below. But is it possible to do it when clicking on the Enter key ? I can't find this property on the text box, it would be like a OnKeyPress property but it doesn't seems to exist on Power Apps. 

I know that there is OnSelect and OnChange option but I don't like it because it trigger the Patch() function while am writing on the Textbox or when I'm selecting it. 
Noah9806_0-1677077602896.png
Does anyone have a solution for this ? 


Thank's in advance for your help

Noah

 

Categories:
  • CU15091556-0 Profile Picture
    49 on 11 Dec 2024 at 13:49:24
    How to trigger an action when Enter key is pressed in a TextBox
    The solution that seems to be working for me is to instruct your users to use the tab button instead of enter.
     
    Select your button in the OnChange property of the text input.  It won't fire until you move the focus away from the text input, which the tab button will accomplish.  In the OnSelect property of the button, do whatever you need to do with the text; reset the text inbox if needed to clear it or prepare it for the next use.  If you need to cursor to come back to the text box, use SetFocus to bring it back to the text input field.
  • abc 123 Profile Picture
    784 Super User 2025 Season 1 on 05 Feb 2024 at 14:59:08
    Re: How to trigger an action when Enter key is pressed in a TextBox

    For anyone else looking, there is no way to create Custom keyboard shortcuts. This link is only for the existing shortcuts built into the app.

  • Motion Profile Picture
    69 on 26 Jan 2024 at 09:17:14
    Re: How to trigger an action when Enter key is pressed in a TextBox

    check out this community solution too

    Solved: Submit Form with the Enter Key - Power Platform Community (microsoft.com)


  • MJ84 Profile Picture
    263 on 22 Feb 2023 at 15:24:33
    Re: How to trigger an action when Enter key is pressed in a TextBox

    yes sorry you referred to textinput in your first post so assumed you were talking about a textinput box 🙂

     

    Glad I could help indirectly if you can mark as solved 🙂 thanks 

  • Verified answer
    Community Power Platform Member Profile Picture
    on 22 Feb 2023 at 15:22:28
    Re: How to trigger an action when Enter key is pressed in a TextBox

    Oh yes I understand the problem now, I was using a TextBox which behave differently than an TextInputBox. That work fine now with the OnChange Property. Thank's for having Helping me indirectly  ! 

  • MJ84 Profile Picture
    263 on 22 Feb 2023 at 15:15:02
    Re: How to trigger an action when Enter key is pressed in a TextBox

    That's strange it's never behaved that way for me

     

    The only real alternative I think is to have a submit button that patches the input box when clicked.

  • Community Power Platform Member Profile Picture
    on 22 Feb 2023 at 15:08:28
    Re: How to trigger an action when Enter key is pressed in a TextBox

    Thank's for your response, but personnaly, the OnChange property is actionned when I finish to write something, without any tabbed, entered or clicked out of the TextInput Box. And that's why it's a problem for me 

  • MJ84 Profile Picture
    263 on 22 Feb 2023 at 15:05:05
    Re: How to trigger an action when Enter key is pressed in a TextBox

    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 textinput box

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 78 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 49

#3
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

Overall leaderboard
Loading started