Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
  • SergiuTPLS Profile Picture
    83 on at
    Re: SubmitForm and stay on the submitted item

    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 

  • russrimm Profile Picture
    Microsoft Employee on at
    Re: SubmitForm and stay on the submitted item

    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

  • RezaDorrani Profile Picture
    12,141 on at
    Re: SubmitForm and stay on the submitted item

    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
    Re: SubmitForm and stay on the submitted item

    @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,141 on at
    Re: SubmitForm and stay on the submitted item

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard