Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Set focus on a control of a canvas app screen when the screen loads

Set focus on a control of a canvas app screen when the screen loads

This is a very common requirement of customers and its quite obvious that the system should automatically focus on first control so that without clicking on the control we can start typing the value directly.

Microsoft Power Apps Canvas provides a PowerFX by using which we can achieve this functionality. Let us see how we can do this.

Step:1 – Open Canvas App with screen

I have created a Canvas App with a form to enable record creation of a table. The below form is used to create student record. But when I open the app the full name field is not auto focused rather I have to manually select the field to enter the value. Now we will fix this.

Step-2: Open App in Editor and add PowerFX on Visible event of Screen

Now to do this task open the canvas app editor and select the screen having the create student form. Choose the screen and open OnVisible action property and mention the PowerFX “SetFocus(DataCardValue19)“. for me the control name is “DataCardValue19”. Use your control inside the SetFocus. Run the app to test.

Test the App

After providing the function if you run the app it will auto focus the first field. Note that if directly open the same screen to test it will not work. Run a different screen and navigate to the create screen then it will work.

Hope this helps