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 / SubmitForm and stay on...
Power Apps
Unanswered

SubmitForm and stay on the submitted item

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

I have a form connected to a SQL datasource, 1 gallery that you select an grouped list of items and a 2nd gallery that is displaying the items that are associated with the selected item in the first gallery.

When I hit Submit on the form, it's auto-selecting the first item in the first gallery and displaying it instead of staying on the selected item that just got submitted.

I tried setting a global variable to the record selected in the first gallery, but the property I would need to have it re-select isn't an option in the Gallery1.Selected.(properties), I presume because i'm doing a groupby?

On my OnSuccess of the form, I have it set to "false".  How do I make Gallery1 stay on the selected item when the form is submitted?

Thanks!  

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,143 on at

    Hi @russrimm 

     

    When you navigate to the screen which shows the form (

    The Item property of the form would probably be Gallery.Selected

    OnVisible of the screen which has the form , do Set(varForm,Gallery.Selected) and replace the Item property with varForm

     

    Next once form is submitted, OnSuccess property of the form do

    ViewForm(formname) - or EditForm(formname)

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • russrimm Profile Picture
    Microsoft Employee on at

    @RezaDorrani wrote:

    Hi @russrimm 

     

    When you navigate to the screen which shows the form (

    The Item property of the form would probably be Gallery.Selected

    OnVisible of the screen which has the form , do Set(varForm,Gallery.Selected) and replace the Item property with varForm

     

    Next once form is submitted, OnSuccess property of the form do

    ViewForm(formname) - or EditForm(formname)

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.


    Hi @RezaDorrani thank you for that.  In my case, I have both galleries and the form on the same screen.  Gallery1 is showing a groupby of the datasource to show only a list of people's names, and Gallery2 is showing a Filter of the datasource, using the name of the person selected in Gallery1 for the filter.  If I change the Item of the gallery to a variable, I get in a bit of a catch 22 as I can't use OnVisible because it's all on one screen.  Is my only option to split it into two screens so I can leverage OnVisible for setting the variable?

    Thanks!

  • RezaDorrani Profile Picture
    12,143 on at

    Hi @russrimm 

     

    You can also trigger the setting of that variable when the item is selected in the gallery

    OnSelect of gallery item - Set the variable

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • russrimm Profile Picture
    Microsoft Employee on at

    Hi @RezaDorrani, thanks again, that got me further, and I think I just realized what my primary issue is.  The gallery I select that controls the form is filtered based on a specific value in that form.  When I change that value, it also updates my collection populating the gallery which removes the record from the collection.  Therefore, there's no way for that item to remain selected because it's gone out of the collection, so it's automatically selecting the first record because the last selected isn't available anymore.  I'm wondering now if there's a way to automatically select the next record in the gallery instead?

    Thanks

  • SergiuTPLS Profile Picture
    83 on at

    Hi @RezaDorrani ,

     

    related to this topic, if I have a Table from witch I select a line, not a gallery, how can I declare that ID var ? 

    once in the form, I submit some info ( like start of the job ), I stay in the form by having the OnSuccess to blank, but the selected info from the from become the first item from the list.

     

    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

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard