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 / Problem with Gallery.S...
Power Apps
Answered

Problem with Gallery.SelectedItem and Gallery.Default after SubmitForm

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

in MyScreen.OnVisible / MyScreen.OnHidden / CancelIcon.OnSelect, I use the following to clear the selection in MyGallery:

UpdateContext({MySelection: MyGallery.Selected}); UpdateContext({MySelection: {}})

To make this work, MyGallery is configured to

MyGallery.Default = MySelection

 

It seems to work like a charm. MyGallery shows all items but none is selected. When I select an item, it shows in MyForm by using

MyForm.Item = MyGallery.SelectedItem

When I click on the CancelIcon it resets MyGallery and the MyForm got nothing to show.

 

Once I submit the form using SubmitIcon.OnSelect:

SubmitForm( MyForm ) 

Now resetting the gallery doesn't work anymore, instead the last Submitted item is selected. Even if I select another item and click on CancelIcon, the last submitted item is selected.

 

Any help what I am doing wrong or how to wok this is highly appreciated,

Dennis

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    I think the issue here should be mostly related to the Form control.

    For the Form control, once the submitform executes successfully, it will switch the form control into EditMode and display the record that has been last submitted, you could find more details in the following page:

    Edit form and Display form controls in PowerApps

    Check the Save changes part.

     

    You could add another Label control, with the text property configured to:

    Gallery.Selected.FieldName

    to check the Gallery selection, and compare with the form display.

     

    Regards,

    Michael

  • Verified answer
    Sienna Profile Picture
    1,532 on at
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    In the "duplicate" I was asking for an alternative way 🙂 Thanks anyway 🙂

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Do you need any further assistance on this topic?

     

    Regards,

    Michael

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    No thanks

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard