cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Robertjde
Helper V
Helper V

disable a button in a gallery after pressing

hello @ all

i have one button per column in my inspection check gallery to transfer the results to my database.

Now it happens that the results of the check are transferred twice because the user can press them several times. For this reason, after pressing the button once, I would like to disable the button, but only for the button in the relevant column.

I am thankful for every help

 
Deaktivieren.PNG
1 ACCEPTED SOLUTION

Accepted Solutions

Please try this (See Attached):
At the beginning of the OnSelect of the Button:

Collect(DisaButton, ThisItem.ID)

 
Then on the Displymode of the button:
If(ThisItem.ID in DisaButton, DisplayMode.Disabled, DisplayMode.Edit)
 
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

View solution in original post

7 REPLIES 7
eka24
Super User
Super User

On the Displaymode of the button put :
If(ButtonName.Value=true,Displaymode.View,Edit)

Unfortunately that does not work (see screenshot).
"Value" is not recognized.

 

3.jpg

Set a variable on Onvisible of the screen:
Set(DisableButton,false)

On the OnSelect of the button put this formula after your main OnSelect action:
Set(DisableButton,true)


Then on the Displaymode of the button:
If(DisableButton=true,DisplayMode.Disabled,DisplayMode.Edit)

It works, but all the buttons in my gallery are disabled, so unfortunately not the solution to my problem. I just want to disable the button for that column in my gallery which is selected.

 

3.jpg

Please try this (See Attached):
At the beginning of the OnSelect of the Button:

Collect(DisaButton, ThisItem.ID)

 
Then on the Displymode of the button:
If(ThisItem.ID in DisaButton, DisplayMode.Disabled, DisplayMode.Edit)
 
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

Yeah, it works !!! I only used one variable on Onvisible of the screen and it runs great.

 

Thank you @eka24  for helping me

 

Here again for everyone in the community:

 

Set to Onvisible of the screen:

Clear (DisaButton)

 

At the beginning of OnSelect of the Button:
Collect (DisaButton, ThisItem .XY)

 
Then in the Displymode of the button:
If (ThisItem .XY in DisaButton, DisplayMode.Disabled, DisplayMode.Edit)

zelga
Frequent Visitor

Hey @eka24 and @Robertjde  I am sorry for interrupting you but i have the exact same problem and tried to use your solution which sounds great, but unfortunately in my PowerApp this doesnt work. I still have the ability to click the "like" button more than once (with my screenshots you can see what i have changed in my App). Do you maybe can see my mistakes i made here? Thanks for help

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,263)