Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Bug: Gallery with textbox control shows the wrong default value

(1) ShareShare
ReportReport
Posted on by 284

 

Hi,

 

I have noticed that the default value of a textbox nested within a gallery control will have the following behaviour which may be a bug. I have put together the following example to demonstrate the bug.

 

Step 1. Insert button1, which will populate a collection by setting the OnSelect formula to

             >>   OnSelect = Collect(Collection1, {Column1Name: “test”})

 

Step 2. Insert a gallery control and set “Collection1” as the data source.

            >>    Items = Collection1

 

Step 3. Insert a textbox into the gallery control. Set the default property of the textbox to the Colum1Name

            >>    Default = Column1Name

 

Now each time when you click “Button1” you will see a new row added to the gallery with the “test” string displayed.. as expected.

Bug_Report1

 

Step 4. Type a new string into the text box on the first row of the gallery. Now press button 1. Each time you press “button 1” now the default value of the textbox is no longer the Colum1Name value as expected.

 

Bug_Report2

 

Has anyone else experienced this issue or able to offer a work around?

Categories:
  • AnthonyPhan Profile Picture
    284 on at
    Re: Bug: Gallery with textbox control shows the wrong default value

    Any Response from the production team? It would be good to get a long term fix for this rather than work arounds.

  • AnthonyPhan Profile Picture
    284 on at
    Re: Bug: Gallery with textbox control shows the wrong default value

    I apreciate everyones suggestions. All have been very usefull. 

    The work around I have used is to save the contents of the gallery to Collection1 everytime button 1 is pressed, Making sure the save happens before creating a new row in collection 1. 

     

     

  • v-xida-msft Profile Picture
    on at
    Re: Bug: Gallery with textbox control shows the wrong default value

    Hi @AnthonyPhan,

     

    I have made a test and the issue is confirmed on my side.

     

    I would post this issue to my product team, if the issue is solved, I would reply here.

     

    In addition, as an alternative solution, I agree with @PeteMc's thought almost. You could consider take a try to reset your Gallery control before adding a new row into your Gallery.

     

    I have made a test on my side, please take a try with the following workaround:2.JPG

     

     

    Set the OnSelect property of the Button control to following formula:

    UpdateContext({GalleryItems:Blank()});
    Collect(Collection1,{Column1Name:"test"});
    UpdateContext({GalleryItems:Collection1})

    Set the Items property of the Gallery control to following:

    GalleryItems

     

     

    In addition, if you want to save the modification within your Gallery control, please take a try with the following workaround:3.JPG

     

    Set the OnSelect property of the Button control to following formula:

    UpdateContext({GalleryItems:Blank()});
    Collect(Collection1,{Column1Name:"test"});
    UpdateContext({GalleryItems:Collection1})

    Set the Items property of the Gallery control to following:

    GalleryItems

    Set the OnChange property of the Text input control within the Gallery control to following formula:

    Clear(Collection1);
    ForAll(Gallery1.AllItems,Collect(Collection1,{Column1Name:TextInput1.Text}))

     

    Best regards,

    Kris

  • Verified answer
    PeteMc Profile Picture
    168 on at
    Re: Bug: Gallery with textbox control shows the wrong default value

    On testing I am having the same issue, a workaround was to reset the gallery at the same time as adding the new item to the collection. I have attached a demo app with this workaround.

     

    The issue with the workaround is that you loose the data you modified at the top, you could have an onChange event on the text box save back to the collection to prevent the data loss.

  • AnthonyPhan Profile Picture
    284 on at
    Re: Bug: Gallery with textbox control shows the wrong default value

    hi @PeteMc

     

    The underying collection data is still the same. Infact if add an additional label displaying the value it will show correctly

    image.png

  • PeteMc Profile Picture
    168 on at
    Re: Bug: Gallery with textbox control shows the wrong default value
    If you go to view the collection from the file menn has it been updated or is it still the original value?

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