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 / How to Preserve values...
Power Apps
Answered

How to Preserve values in the textinput inside the gallery when switching the choices in the combo box

(0) ShareShare
ReportReport
Posted on by 92

the goal is to allow users to enter values into text input fields within a gallery based on a selected choice in a combo box. However, when users switch between different choices using a combo box, the entered values in the text inputs should be preserved and displayed if the user returns to a previously selected choices in the combo box.

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

    Hi @LsLee ,

     

    You can use AddColumns to add multiple columns for each choice and patch inputs to corresponding choice columns.

    Assuming that Items of combo box is this.

    ["Choice1","Choice2"]

    Step1.

    OnStart of App or OnVisible of Screen.

    ClearCollect(COL,AddColumns(DataSource,Choice1,"",Choice2,""))
    

    Step2.

    OnChange of TextInput.

    Switch(ComboBox.Selected.Value,"Choice1",Patch(COL,ThisItem,{Choice1:Self.Text}),"Choice2",Patch(COL,ThisItem,{Choice2:Self.Text}))

    Default of TextInput.

    Switch(ComboBox.Selected.Value,"Choice1",ThisItem.Choice1,"Choice2",ThisItem.Choice2)

    Step3.

    It should have a column in your data source to save selected choice.

    OnChange of Combo box.

    Patch(COL,ThisItem,{Title:Self.Selected.Value})

    DefaultSelecteItems of Combo box. 

    {Value:ThisItem.Title}

     

     

    Best regards,

    Rimmon

  • LsLee Profile Picture
    92 on at

    Thank you for the guidance.

    Can the Powerapps also achieve this?

    the entered values persist in the gallery even when the ComboBox filter is cleared

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

    Hi @LsLee ,

     

    You can add a condition in Switch function to set default value when combo box is cleared.

    Something just like this.

    Switch(ComboBox.Selected.Value,"Choice1",ThisItem.Choice1,"Choice2",ThisItem.Choice2,"","the entered values you want to keep")

    The entered values for each choice is not lost, as the input value has already been saved to the corresponding column.

     

    Best regards,

    Rimmon

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 509 Most Valuable Professional

#2
Haque Profile Picture

Haque 302

#3
11manish Profile Picture

11manish 265

Last 30 days Overall leaderboard