Skip to main content

Notifications

Power Platform Community / Forums / Build A Canvas App / Disable Button in Gall...
Build A Canvas App
Unanswered

Disable Button in Gallery after it was clicked

Posted on by 4
Hello!
 
I am building a PowerApp for my school and encountered a Problem that I seem to not be able to solve. Therefore I hope you can enlighten me regarding where to look for solutions. 
 
I display a Gallery to my users with a couple of entries (different courses with times, rooms, etc.). For each entry there is also a Button through which they can enroll into the course. This Button is only visible if the person is not enrolled in the course already. I check for that with a LookUp into a Sharepoint-List. If the Person is already a participant in this course it does not show.  If the Person clicks the button a Flow is triggered, that adds the person to the list. 
 
 
Now I encounter a Problem. After the button was clicked it is still active until the Flow finished putting the name into the list and I refreshed the screen/gallery. But the Flow takes a couple of seconds to run and in the meantime the button is still active. If I refresh the screen before the entry was made, the button is still visible and the user could press it again (and again, and again....).
 
Therefore I want to disable the button after it was clicked but cannot figure out how to do it. I tried a couple of different things. The OnSelect Property of the button looks like this:
 
trigger_Foerderstundenanmeldung.Run(User().FullName,User().Email,ThisItem.ID) ; Refresh('Foerderstunden-Tracker')
 
I tried to add things like:
Self.DisplayMode = DisplayMode.Disabled
or
DisplayMode.Disabled
or
Set(DisplayMode, Displaymode.Disabled) <--- which only throws errors because it is not a variable
 
Is there a way to change the DisplayMode of the button that was clicked? If I use a variable for that it always changes the property for alle buttons on all rows/entries, not just the one that was clicked. I don't really know a way to just access the currently active element opposed to all of the similar ones.
 
Your help would be very much appreciated!
Categories:
  • DomDomDom Profile Picture
    DomDomDom 4 on at
    Disable Button in Gallery after it was clicked
    Thank you kasraouiah for your answer. Unfortunately it does not really answer my question completely. The App (and Flow) are not "live" yet and I am still testing stuff. The completion of the flow to add a person to the attendence-list takes a couple of seconds regardles of number of active executions. It takes a couple of seconds with just one singular execution. 

    I would need a way to target a buttons DisplayMode within a Gallery-item without changing the attibute for all similar buttons of the other Gallery-item. 
     
    My current solution is to start a timer after button press and disable ALL the "enroll-"Buttons of the Gallery (for each Gallery-item) for a fixed timeframe before enableing them again. This is not a good solution or even a "usable" solution. But it is the only thing a can manage so far, that prevents my users from enrolling into the same lecture multiple times.
  • kasraouiah Profile Picture
    kasraouiah 33 on at
    Disable Button in Gallery after it was clicked
    Hello,
    I think if you set you flow traget only one item not the whole sharePoint List item, the issue is more focused on you PowerApps, i may suggest a trick to use a counter  (global or local) variable, that limit number of exuction for the flow for only one execution

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

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,008

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,531

Leaderboard

Featured topics