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 / Require gallery item b...
Power Apps
Unanswered

Require gallery item be selected

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

 

Working on an internal company app and trying to ensure that users select a "desk" before moving to the next screen. Right now the way its set up is they hit a checkbox and then a continue button that will set the desk for the reservation and navigate to a confirmation screen. I need to find a way to only allow this if an item is actually selected as one user was able to make a reservation with no desk selected.

 

Gallery code is 

 

 

Filter(Desks,Not(Title in Filter(
'Desk Reservations',
CheckOutFrom >= startTime && CheckOutTo <= endTime || CheckOutFrom <= endTime && CheckOutTo >= endTime
).DeskText))//Filter('Desk Reservations','Check Out From' >= startTime && 'Check Out To' <= endTime || 'Check Out From' <= endTime && 'Check Out To' >= endTime)

 

 

Button 

 

 

Navigate(Confirm)

 

 

 

I have been googling this for a few weeks now and tried some various methods but no dice thus far. Any hints as to how to do this would be greatly appreciated. 

Categories:
  • PaulD1 Profile Picture
    2,914 on at

    I believe a gallery always has a selected item (assuming it contains at least one record) and this will be the first entry in the gallery unless the user selects something else.

    If you want to ensure the user has actually interacted with the gallery, you could put some code in the Gallery's OnSelect action - e.g. UpdateContext({conSelectedDesk: ThisItem}).

    In the screens OnVisible action, you may want UpdateContext({conSelectedDesk: Blank()}).

    You can set the DisplayMode of your button to: If(IsBlankOrError(conSelectedDesk),Disabled,Edit).

    You could add a check box to your gallery and set the Default property to: ThisItem.ID = conSelectedDesk.ID

    In the above I am assuming ID is your primary key field.

    I would make the button OnSelect: Navigate(confirm, fade, {conSelectedDesk: conSelectedDesk})

    The above will pass through the context variable conSelectedDesk and you can reference this instead of gallery.selected which I have found to be problematic in some circumstances.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the info, and this is where I am going to feel dumb as I am still really new to this. I can't seem to figure out how to actually implement this. OnSelect shows an error. Is there a document that would explain this better, having no luck with my googlefu and starting to feel a bit dumb haha.

  • MitaSaxena Profile Picture
    11 on at

    Hi,
    Think we are working on the same app, and I found a lot of similar issues. Glad that I am not the only one 🙂
    For this particular one, I used the statement for Continue button - OnSelect - If(IsBlank(selectedDesk), UpdateContext({varshowpopup:true}), Navigate(Confirm)) - so if no check box is selected, then there is a pop-up error message;

    MitaSaxena_0-1607374893279.png

     

    For working out how to do the popup - I followed this youtube video - https://www.youtube.com/watch?v=SaDEVOgOlYY&t=304s

     

    Beginer like you, but getting there. 

     

    Hope this helps.

    Mita

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard