web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove Focus or Auto E...
Power Apps
Answered

Remove Focus or Auto Enter a text box.

(0) ShareShare
ReportReport
Posted on by 12

Hi, 

Currently I have a function setup for a Textbox OnChange that navigates to the next screen when the textbox is not empty. 

How can I make it so the textbox is unselected as soon as text is entered?

the function works as soon as the textbox is unselected by hand. 

It looks as follows 

If(IsEmpty(LocationCode)=false, Navigate(Group1_1));

Thank you 

Categories:
I have the same question (0)
  • Barakat Profile Picture
    35 on at

     

    You can use the "UpdateContext" function to set the focus to another control after the user enters text in the textbox. Here's an example of how you can modify your code to achieve this:

    1. Add a new variable to your screen, called "shouldFocus". Set its initial value to "true".
    2. Modify your existing function to include an UpdateContext statement, like this:

       

       
      If(IsEmpty(LocationCode)=false, UpdateContext({shouldFocus: false}); Navigate(Group1_1));

       

      1. Add an "OnSelect" property to the control that you want to set focus to after the user enters text. In this property, use the following formula:
        If(shouldFocus, SetFocus(AnotherControl)); UpdateContext({shouldFocus: true})

        This formula checks whether the "shouldFocus" variable is true. If it is, it sets focus to "AnotherControl". It then resets the "shouldFocus" variable to true, so that the next time the user enters text in the textbox, the control will be focused again.

        With these changes, when the user enters text in the textbox and the function is executed, the focus will immediately be set to the control you specify in the "OnSelect" property.

         
  • Verified answer
    GiovanniM2 Profile Picture
    12 on at

    Hi Everyone, 

    I figured it out. 

    I wanted to make a system for barcode scanning that automatically hit enter once text was entered into a text box after scanning. 

    I used this post: https://powerusers.microsoft.com/t5/Building-Power-Apps/When-MaxLength-is-reached-switch-to-another-TextInput/m-p/1668582#M424756

    I replaced the Length = number in the toggle switch to Length >= 1, and then I made it when the toggle was activated it would select an invisible button that did nothing which would cause the text box to be unselected. 

    Hope this helps anyone else out there! 

  • GiovanniM2 Profile Picture
    12 on at

    Thank you for your help, but I found the solution to my issue! 

    I appreciate your time. Hopefully this may solve another persons issue 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,074

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 606

Last 30 days Overall leaderboard