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 / Check gallery items on...
Power Apps
Unanswered

Check gallery items on button click when the app is launched

(0) ShareShare
ReportReport
Posted on by 64

I've created a Forms based on a gallery, and I'm checking if there is any blank field when a button is selected, so the app doesn't move to the next screen while there are blank fields.

I realized that when I initiate the app for the first time (literally when I launch the app), my check doesn't work if I haven't filled any field yet. Which means that it considers all fields filled (and enables to move to the next screen), even if I select the button more than once.

 

On the other hand, if I select any field (I don't need to fill) and then click the button, it works. Here is the code:

 

Button.OnSelect =

ForAll(Gallery11.AllItems,
If(
Or(
 
And([@TextInput3_37].Visible = true, IsBlank([@TextInput3_37])),
And([@TextInput3_38].Visible = true, IsBlank([@TextInput3_38])),
And([@TextInput3_39].Visible = true, IsBlank([@TextInput3_39])),
And([@TextInput3_46].Visible = true, IsBlank([@TextInput3_46])),
And([@TextInput3_47].Visible = true, IsBlank([@TextInput3_47])),
And([@TextInput3_48].Visible = true, IsBlank([@TextInput3_48]))
) = true, 

Collect(CollectionTF, {Boolean: false}),
Collect(CollectionTF, {Boolean: true})

))

 

Is there a way to "force" the app to initiate the fields to make it work?

 

Thank you!

Categories:
  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @gasilva8 ,

    You can condense your code as below, however have you considered setting a Variable on the button push to display the gallery (if it is not set already), then running the code if it is set.

    ForAll(
     Gallery11.AllItems,
     Collect(
     CollectionTF,
     (TextInput3_37.Visible && IsBlank(TextInput3_37) ||
     (TextInput3_38.Visible && IsBlank(TextInput3_38) ||
     (TextInput3_39.Visible && IsBlank(TextInput3_39) ||
     (TextInput3_46.Visible && IsBlank(TextInput3_46) ||
     (TextInput3_47.Visible && IsBlank(TextInput3_47) ||
     (TextInput3_48.Visible && IsBlank(TextInput3_48)
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • gasilva8 Profile Picture
    64 on at

    @WarrenBelz, thank you for the tip!

     

    The gallery is set on Screen.OnVisible. You are saying that I have to set the gallery on a button push, and then check if it has blank fields with another button?

    Could you please clarify how to do that?

     

    Thank you!

     

     

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @gasilva8 ,

    I was only responding to your apparent refresh issue, which appears to need some initiation. On second thought, this may not work either. Try on Screen OnVisible

    Select(YourGalleryName)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • gasilva8 Profile Picture
    64 on at

    Hey @WarrenBelz. Understood, thank you!

     

    I tryed to set Select(Gallery) on Screen OnVisible, but I got the error:

    "Select of a control that is within a container control, such as gallery, from outside the container. Select can be used within a container control when both control are within the same container."

     

    image.png
  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @gasilva8 ,

    This is the first time you have mentioned containers and may explain the whole issue. I do not use these (I maintain the "keep it simple" principle) and generally find all code works as expected.

  • gasilva8 Profile Picture
    64 on at

    Hi @WarrenBelz!

    Actually I'm not using containers, but the error message mentioned that.

    I think since my gallery is inside that specific screen (where I set the OnVisible property to Select(Gallery)), PowerApps considers that as a container.

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @gasilva8 ,

    As I noted - it may not work. I have not encountered the behaviour you are experiencing.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard