cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mpezzutti
Level: Powered On

Disabling a button once it is pressed

Hello
I would like to disable the button once I pressed it once.
Thank you
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Disabling a button once it is pressed

Hi @mpezzutti ,

Do you want the button disabled after clicking once?

I suggest you use a variable to justify.

Set the button's OnSelect:

If(IsBlank(vari),action,false);Set(vari,1)

Then, the action can only execute once beacuse the variable will not be null after clicking the button once.

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
cwebb365
Level 10

Re: Disabling a button once it is pressed

don't know if there is easiers way but you could set an IF function in your DisplayMode property on the button you want to disable. Then use a variable to key off of. On the screen visable property initialize a variable with updatecontext({btndisabled:false}). So whatever it is that "Disables" that button, if it's an onSelect then in that property you can trigger an updatecontext to set the variable to opposite of what it currently is. So use onSelect to: updatecontext({btndisabled:!btndisabled}) and anything you do that onselect or whatever event fires it will set the opposite. 

 

Anyway, set the IF statement on the button you want disabled DisplayMode to IF(btndisabled,DisplayMode.disabled,DisplayMode.Edit) this should do the trick. 

Highlighted
hnguy71
Level 8

Re: Disabling a button once it is pressed

I'll expand on @cwebb365 idea,

Using a screen's OnVisible property do something like this:

Set(_DisableButton, !_DisableButton)

 then on the button's OnSelect property do something like this:

If(!_DisableButton, UpdateContext({_DisableButton: true});Do_Something_Only_Once)

That way it'll only fire once. Or you can set a variable between 0 and 1 and if it's a particular value you set a property to view or false.

Community Support Team
Community Support Team

Re: Disabling a button once it is pressed

Hi @mpezzutti ,

Do you want the button disabled after clicking once?

I suggest you use a variable to justify.

Set the button's OnSelect:

If(IsBlank(vari),action,false);Set(vari,1)

Then, the action can only execute once beacuse the variable will not be null after clicking the button once.

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mpezzutti
Level: Powered On

Re: Disabling a button once it is pressed

hi  Phoebe Liu

This works . Thanks so much

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 274 members 4,239 guests
Please welcome our newest community members: