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 / Gallery Fields Lose Fo...
Power Apps
Unanswered

Gallery Fields Lose Focus OnChange

(1) ShareShare
ReportReport
Posted on by 1,207

I am using a gallery to capture line items. I would like the OnChange of the text fields to update a collection. The problem is when tabbing or clicking to the next field, the OnChange fires and the field loses focus. This doesn't make for a nice user experience because the user needs to click in the box a second time.

 

Digital_0-1635396234898.png

There is a way round this by using ForAll on Gallery.AllItems in my save button to patch the collection. Unfortunately Power Apps doesn't allow me to access the text input values if the text inputs are in layout containers within the gallery (which mine are). I could re-do my gallery without containers but this will be very time consuming and not very flexible if I want to make changes to layout, add new fields etc.

 

Wondering if anyone has encountered this and know of a solution.

 

Categories:
  • vermaaman Profile Picture
    134 on at

    @Digital if your combobox is outside of gallery then you can use SetFocus onChange.

  • Digital Profile Picture
    1,207 on at

    @vermaaman , unfortunately it needs to be inside a gallery as it is for collecting repeating lines of data. Looks like I'll need to ditch the layout containers and use ForAll with Gallery.AllItems to patch the values after they've been entered.

  • Wouter_K Profile Picture
    67 on at

    @Digital Hi, did you ever find a solutions without loosing the layout container?

     

    Any reply is greatly appreciated.

  • Digital Profile Picture
    1,207 on at

    @Wouter_K , There is a workaround that enables you to keep the layout containers in the gallery. You to create a duplicate collection and update this in the OnChange. This gets around the field losing focus on tab but introduces the added complexity of dealing with a duplicate collection.

  • beejo Profile Picture
    32 on at

    I ran into this too, and the second Collection workaround seems to be working well.  For anybody needing more explicit instructions, see: www.reddit.com/r/PowerApps/comments/uj7k4d/losing_focus_on_item_within_gallery/

     

    I called them a "read" collection (what the gallery displays and what new entries go into) and a "write" collection (which is what I'm updating on gallery changes).  Data flows from data source to "read" to "write" back to data source.

  • vikas1606 Profile Picture
    206 on at

    Hi @Digital ,

    I'm currently experiencing the same issue. I've been attempting to use Gallery.AllItems in the save, but so far, it's not functioning correctly for me. I wanted to ask if you have encountered this problem and if you managed to resolve it. I understand that this conversation is a bit delayed, but I wanted to reach out and inquire about your solution. Thank you in advance for your assistance!

     

  • mychau Profile Picture
    56 on at

    Thanks for the workaround. I had the same issue.

  • huapie Profile Picture
    2 on at

    Thank you, you save my time.

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard