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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set focus on a specifi...
Power Apps
Answered

Set focus on a specific field after clicking on new

(0) ShareShare
ReportReport
Posted on by 26

Hi all,

 

i have created a sharepoint list ann i am edting the form through power aps. I have some columns as fields and the fields are being filled while the user is scanning barcodes. In order to minimize the manual clicks of the user i have set up set focus on each change.

kmarantos_0-1655719009059.png

on the last field i set up the following commands so the form will be uploaded automatically and then close the window.

kmarantos_1-1655719064689.png

Additionally i have set up on the screen level on visible set focus on the first card value.

kmarantos_2-1655719234501.png

The point is when the user clicks new then the cursor in on the first field.

Until then everything are working great when the user clicks for the first time "new". The form pops up and the first field is selected. On the second opening of the form non of the fields are selected. It should be the first but it doesnt work. The function that i want to have is to have the first field selected anytime the user clicks "new".

Could anybody see my case and help eventually?

Thank you in advance.

 

 

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    HI @kmarantos,

    Could you please where is the new button in your scenario?

    Do you mean that the SetFocus() function does not work for the form?

     

    Actually, there are some limitations for the SetFocus() function:

    vqiaqimsft_0-1655882747675.png

     

    As a workaround, you could add a scrollable screen including input controls, and set the OnVisible property of the screen as your SetFocus() function.

     

  • kmarantos Profile Picture
    26 on at

    Hallo and thank for replying,

    the new button i mentioned is the button in sharepoint list.

    kmarantos_0-1655884664971.png

    If i realod the page and click for the first time "new" and the first field of the form is selected. After the first saving of the form, if i click the "new" button again then the first field is not selected automatically.

    I have read the docus but the set focus works the first time as i said. I thought that the first field can be selected automatically everything i call the form.

    How can i change the screen of the form to a scrollable screen? Should i add new fields only to make it longer?

     

    how

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @kmarantos,

    vqiaqimsft_0-1655885251508.png

    I think it is much more complex if you use the scrollable screen because you should add controls one by one and you could only use the Patch() function to add/edit records.

     

    Further, the OnVisible property fires only when a screen is on visible from another screen, so it maybe the key to your issue that the same screen pops out always so the SetFocus() function works only for the first time.

    I have tested that the SetFocus() function could apply to an form control and other users have also reported they could achieve this using a form control.

     

    Here is another way to achieve your need, please check for reference:

    1). Add another new screen in your custom form app, set the button Text property as below:

    "Click to add new"

    Set the OnSelect property as below:

    Navigate(FormScreen1)

    2). Set the OnVisible property of the FormScreen1 as below:

    SetForcus(DataCardValue2)

    3). Click the "Back to SharePoint" and select the "Save and Publish"

    vqiaqimsft_1-1655886760426.png

    Then you could click the button and it will navigates you to the form where the data card value will be set focus.

     

  • kmarantos Profile Picture
    26 on at

    Thank you again for your response. We are getting somewhere!

    I created the button and the first time i click new the form app works ( first screen with the button->second screen with correct focus on the filed). If i close the windows and click again "new" then the form app starts directly from the second screen. What is missing in this case?

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @kmarantos,

    I think I have reproduced your issue on my side.

    Here is the thing, each time you click the new button and close it by clicking the save button, you should refresh the current list page so that the SetFocus() function could work again. This is annoying.

     

    Fortunately, I have thought of another solution to solve this issue.

    Instead of manually refreshing the list page every time you close the window, I think we could directly set the OnNew property of the SharePointIntegration to navigate the user to the first screen where exists a navigate button to navigate users to the form screen.

     

    Set the OnNew property of the SharePointIntegration as below:

    Navigate(FormScreen1)

    Then every time you click the new button in the list page, it will navigate you to the first screen, then once you click the navigate button, it will make the form on visible so that the SetFocus() function could be triggered automatically.

  • kmarantos Profile Picture
    26 on at

    Thank you very much! It works like a charm! 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard