Showing results for 
Search instead for 
Did you mean: 
Advocate III
Advocate III

Collect Gallery Textfields

I created a form that has a gallery which contains three text fields. When the screen loads (onVisible) a collection using ClearCollect:


Then I added a gallery with the three text fields, and button:



I added to the OnSelect for the Add Button a Collect:

        Filing: filingInput.Text,
        Mapfilename: MapfilenameInput.Text,
        Crops: cropsInput.Text


This adds a new row as desired, and an empty row to the collection, but doesn't collect any data from the Text Fields



Collection for empty rows:



I'm guessing I'm, missing for ForAll some where to iterate all text fields in each gallery row, and specify where each one goes in the collection, but I really don't know how to this. 


Thanks for any help.


Continued Contributor
Continued Contributor

You can update the collection in the OnChange of each text input. Example for the Filling textbox:

Patch(CropsImpacted, ThisItem, {Filing: Self.Text})
Super User
Super User

hi @emfuentes27 , @Cooper01 gave a solution to you. for information, the reason why the collection is empty is when you collect a new item the texboxes are empty and the data is never updated (patched). 


Hope that shed some light on it.

@rubin_boer .Working on @Cooper01 solution now. By the way, the text fields are not empty. If you look at the images I provided when submitted the question, there some random text I entered. Thanks.

Super User
Super User

@emfuentes27 when you look at your textbox in the gallery (at design time) what is the default value? It will be odd if the textboxes have those values as default and not be in the collection. 


enjoy the app.

Advocate III
Advocate III

@rubin_boer . The initial values for the collection when the screen loads are just empty. Which is what want. Then when I fill text fields, and add them to the collection, which in return feeds the gallery. Thanks.

Super User
Super User

sorry to label the point, i think we are talking pat each other. Laste attempt and i will let be, eeing you on your way to sort this which is great.


When you design the app, adding an item takes the default value of the textbox. when its empty it will add an empty item 



adding items

At runtime, it will add empty boxes and you update them, these empty boxes are what was used to collect the data in your collection.


The collection



Now if your textbox would have had data in as default data, your collection would have captured it.



Adding Items

At runtime



you collection have the data now



Hope this clears I more.


Have fun









Thanks again @rubin_boer . I noticed that behavior, and it was driving crazy. At the end I decided to just create three text field outside the gallery, and it works much better, and I think is easier to manipulate the data. I just deleted the first row of the collection after declaring it:



I know this is probably a very ugly solution, but it's working as I wanted. If you have a better and cleaner solution I would appreciated. Thanks so much.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,138)