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

Enable/Disable buttons on select

Hi,

 

I am super new to powerapps, but trying to get my teeth into it.

 

I have three buttons:

 

  • YesButton
  • NeutralButton
  • NoButton

When the YesButton is selected, I want it to be the only button visible of these three, when the NeutralButton is selected, I want it to be the only button visible of these three and when the NoButton is selected, I want it to be the only button visible on this page.

 

How do I achieve this?

 

I have tried this - UpdateContext({NeutralButton: false}) as the OnSelect formula for YesButton as per this post , but that doesn't seem to work for me.

 

Thank you n advance.

 

Jon

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Enable/Disable buttons on select

Hi @jdrussell78 

 

Can you try to setup the config like:
 
Screen -> OnVisible -> Set(SelectedButton,Blank())
 
YesButton -> OnSelect -> Set(SelectedButton,"yes")
YesButton -> DisplayMode-> If(SelectedButton= "yes" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
NeutralButton -> OnSelect -> Set(SelectedButton,"neutral")
NeutralButton -> DisplayMode-> If(SelectedButton= "neutral" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
NoButton -> OnSelect -> Set(SelectedButton,"no")
NoButton -> DisplayMode-> If(SelectedButton= "no" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
Dual Super User
Dual Super User

Re: Enable/Disable buttons on select

Hi @jdrussell78 

 

Can you try to setup the config like:
 
Screen -> OnVisible -> Set(SelectedButton,Blank())
 
YesButton -> OnSelect -> Set(SelectedButton,"yes")
YesButton -> DisplayMode-> If(SelectedButton= "yes" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
NeutralButton -> OnSelect -> Set(SelectedButton,"neutral")
NeutralButton -> DisplayMode-> If(SelectedButton= "neutral" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
NoButton -> OnSelect -> Set(SelectedButton,"no")
NoButton -> DisplayMode-> If(SelectedButton= "no" || IsBlank(SelectedButton), DisplayMode.Edit, DisplayMode.Disabled)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Super User
Super User

Re: Enable/Disable buttons on select

@jdrussell78 

Begin by placing this code in the OnVisible property of your screen.

 

Set(buttonPressed, Blank())

 

Next, put this code in the OnSelect property for each button. 

 

Yes Button:        Set(buttonPressed, "Yes")
Neutral Button:    Set(buttonPressed, "Neutral")
No Button:         Set(buttonPressed, "No")

 

Finally, put this code in the Visible property for each button.

 

Yes Button:        buttonPressed="Yes" Or IsBlank(buttonPressed)
Neutral Button:    buttonPressed="Neutral" Or IsBlank(buttonPressed)
No Button:         buttonPressed="No" Or IsBlank(buttonPressed)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

jdrussell78
Level: Powered On

Re: Enable/Disable buttons on select

@yashag2255 thank you this kind of works, however, when I have clicked the Yes button, the other two do disable.  But I can't seem to cancel.  How would I go about having a cancel button that clears the form to its previous state ?

 

 

Screenshot 2020-01-19 at 18.16.16.png

Super User
Super User

Re: Enable/Disable buttons on select

@jdrussell78 

You would put this code from the example of @yashag2255 into the OnSelect property of a Cancel button

Set(SelectedButton,Blank())

 

Dual Super User
Dual Super User

Re: Enable/Disable buttons on select

Hi @jdrussell78 

 

You can add a separate button for cancel and on the "OnSelect" property of the cancel button, use the expression: Set(SelectedButton,Blank())
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,398)