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.

View solution in original post

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. 

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.

View solution in original post

mpezzutti
Level: Powered On

Re: Disabling a button once it is pressed

hi  Phoebe Liu

This works . Thanks so much

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,649)