Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Retain some form data after submitting.

(0) ShareShare
ReportReport
Posted on by 207

I have a form to record visitor details and after submitting the form I want most fields to clear, but the "Host" and "Visiting Site" fields to retain their values as this info will always be the same for the session and dont want to have to keep retyping the "Host" and "Visiting Site" details.

 

The only time the "Host" and "Visiting Site" fields should be cleared is when the "Restart" button is selected.  How can i clear most fields, but keep "Host" & "Visiting Site" populated when the form is submitted?

 

 Thanks in advance, 

Categories:
  • tbrewer Profile Picture
    7 on at
    Re: Retain some form data after submitting.

    Hello @mdevaney ,

     

    Your solution above works wonderfully. I am having trouble getting a combo box to retain the last submit form info. Any tricks to that specific input type?

  • NatM Profile Picture
    2 on at
    Re: Retain some form data after submitting.

    If someone is still looking for a solution on this...

    Just add the following (with brackets and everything) to the defaultselecteditems property. I was adding only to the default property, but since the field is a combobox it needs to go to the latter instead.

    That should solve your problem.

     

    [Parent.Default]

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on at
    Re: Retain some form data after submitting.

    @StuartSmith 

    I am becoming a little bit confused here.  It might be time to start a new topic and rexplain the problem now that you've solved the 1st one.  Sorry.

     

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    Hi, do you know why its adding the last submitted entry for "Host", but not "Visiting Site"?  The "Visiting Site" sharepoint list type is "Choice", if that makes a difference?

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    I have also been trying to follow your example and display the CurrentVisitngSite value in a lablel, but current trying to figure out the code.

     

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    Hi, I managed to get the "Host" one working, i simply removed/re-entered your code. But oddly the"Visiting Site" combo box doesnt display the current value?    see attached.

     

    The code I am using is...

    Set(CurrentVisitingSite,Visitor_Registration_Form.LastSubmit.Visiting_x0020_Site);  or

    Set(CurrentVisitingSite,Visitor_Registration_Form.LastSubmit.VisitingSite); (this is how the sharepoint list column is named)

     

    I also removed the line 

    NewForm(Visitor_Registration_Form);

    as this was preventing the form data from showing in the gallery. 

     

    I have also been trying to set the "DisplayMode" of the host field to "view", using the code

     

    "If(IsBlank(CurrentHost), DataCardValue14_1.DisplayMode.View, DataCardValue14_1.DisplayMode.Edit);"

     

    But also cant get that to work. 

    Thanks in advance, 

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on at
    Re: Retain some form data after submitting.

    @StuartSmith 

    "Thanks for taking the time to supply an alternative solution.  I done as you suggested and the code was accepted (no red crosses), but upon pressing the "Submit" button, the details are not submitting it to the sharepoint list and the gallery on the form, they just stay showing on the form.  Any ideas?"

     

    I want to know why the form is not submitting.  Please create a label with this code in it.  Does any error appear in this label after you click submit?

    Form1.Error

     

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    So ultimately, what I want to achieve is that no matter how many rows are added for the current session, the "Host" and "VisitingSite" details will always be the same as row 1.

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    Another option, would be to disable the "Host" and "VisitingSite" combo boxes if 1 record has already been submitted and then pre-populate the "Host" and "VisitingSite" values of any additional rows with the "Host" & "VisitingSite" values found in the first row?  Don't know if that would be easier?  Hope that makes sense.

  • StuartSmith Profile Picture
    207 on at
    Re: Retain some form data after submitting.

    Thanks for taking the time to supply an alternative solution.  I done as you suggested and the code was accepted (no red crosses), but upon pressing the "Submit" button, the details are not submitting it to the sharepoint list and the gallery on the form, they just stay showing on the form.

     

    Any ideas?

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,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard