cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ngreen
Level: Powered On

Have a text input selected on App Startup

Hello,

 

I'm trying to make a powerapp where I would like to have an edit form's text input data card selected immediately on the app's startup to avoid having to click into it and begin typing. The purpose of this would be for data entry on an ID swipe and it can only populate if the datacard is selected. Rather than have people have to click and then swipe, I'd like them to just be able to swipe, but I'm not sure how to get this to work. With any luck, I'll be able to do this and have the datacard hidden too.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Have a text input selected on App Startup

@ngreen 

PowerApps has some issues with this and its noted in the documentation.  The last example found within the link I provided will tell you how to accomplish what you want to do.

In summary, start by creating a new screen.  Then place a button with the OnSelect property having the code below

 

Navigate(FormScreen,None);

 

Then create the FormScreen.  Write the following code in the OnVisible property of the screen.  Replace TextInput1 with your control's name.

 

SetFocus(TextInput1)

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Have a text input selected on App Startup

@ngreen 

PowerApps has some issues with this and its noted in the documentation.  The last example found within the link I provided will tell you how to accomplish what you want to do.

In summary, start by creating a new screen.  Then place a button with the OnSelect property having the code below

 

Navigate(FormScreen,None);

 

Then create the FormScreen.  Write the following code in the OnVisible property of the screen.  Replace TextInput1 with your control's name.

 

SetFocus(TextInput1)

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

ngreen
Level: Powered On

Re: Have a text input selected on App Startup

@mdevaney,

 

Looks like you can do this with a blank screen and an incredibly short timer so that it looks like the app is still loading and then navigates to the page with the input highlighted for Focus. It doesn't necessarily have to be a button like their documentation says, just as long as there is a new navigation to the page with the Focus

Super User
Super User

Re: Have a text input selected on App Startup

Can you please share the code? I’d like to see it!
ngreen
Level: Powered On

Re: Have a text input selected on App Startup

@mdevaney 

 

Sure! Here is my app setup so far:

 

Screen 1: StartScreen

  • Timer1
    • Duration = 1
    • OnTimerEnd = Navigate(IDscreen,None)

 

Screen 2: IDscreen

  • OnVisible = SetFocus(TextInput1)
    • Label3: “Please swipe your ID”
    • TextInput1
      • *This is just the text input box that receives the ID’s number on swipe with a magnetic reader
    • Form1
      • IDCardNumber
        • DataCardValue34
          • Default=TextInput1

 

Screen3: Personal Info

  • This is just a screen with an Edit Form to collect user information

 

Screen4: Device Info

  • This is just a screen with an Edit Form to collect device information

 

Screen5: Confirm

  • Label1: “Thank you for registering your device!”
  • Timer1
    • Duration = 2000
    • OnTimerEnd = Reset(TextInput1); ResetForm(Form1); ResetForm(P_Form); ResetForm(D_Form); Navigate(IDscreen,Fade)

 

This allows the app to cycle back around to the IDscreen after each completion to be ready for the next guest, as returning to the StartScreen isn't needed since the timer from Confirm can trigger the SetFocus. The StartScreen's sole purpose is to trigger the SetFocus, which it can do with such a small timer that it just looks like the app is still loading and makes the user think the IDscreen is the initial screen of the app and that it is ready to go.

 

One trick to this is that I have to have the textinput1 visible for it to collect the ID swipe data, so I'm just hiding it behind an image of an ID card scanner.

Super User
Super User

Re: Have a text input selected on App Startup

@ngreen 

I really enjoyed reading about your workaround and that how you outsmarted the official documentation.  Thank you for sharing the full details.  I could see myself using this in the future.

ngreen
Level: Powered On

Re: Have a text input selected on App Startup

@mdevaney,

 

You are welcome! The idea popped into my head late last night so I'm glad it ended up working when I tried it this morning. Glad I could help you out in return since I am so new to all of this. I suggested it on that documentation page, so maybe they'll add it there.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,962)