cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DGWolfe
Helper I
Helper I

How do I get my button to disable after pressed?

Hi,

 

I have a canvas app, and I have a few buttons. Each button makes hidden sections of choices appear. I would like this to be a "pressed once, and then disable" type experience.

 

I have read through all the similar posts, and tried a few work arounds, but  nothing seems to work.

 

The buttons create collections and unhide sections. After that, it shouldn't be able to be used again. 

 

Any suggestions on how I can overcome this?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @DGWolfe ,

You need to set a Variable (call it whatever you want) on the button OnSelect 

UpdateContext({varDisable:true})

Then the DisplayMode of the Button

If(
   varDisable,
   DisplayM<ode.Disabled,
   DisplayMode.Edit
)

Also at Screen OnVisible (and whenever you want the button to work

UpdateContext({varDisable:false})

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @DGWolfe ,

You need to set a Variable (call it whatever you want) on the button OnSelect 

UpdateContext({varDisable:true})

Then the DisplayMode of the Button

If(
   varDisable,
   DisplayM<ode.Disabled,
   DisplayMode.Edit
)

Also at Screen OnVisible (and whenever you want the button to work

UpdateContext({varDisable:false})

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

DGWolfe
Helper I
Helper I

Thank you @WarrenBelz this worked perfectly!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,637)