cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Set Enabled/Disabled with change on a Dropdown/List

Hey guys

 

Just as the title says, I'm trying to set Enabled or Disabled some buttons and labels according to the users selection on a Dropdown / List. I tried to set the Buttons/Labels to disabled if the SelectedItem.Value of the list is equal to a "string", set OnChange, but it seems I'm not doing it right, I also tried OnSelect. Any tip will be helpful 

If I'm not clear enough please ask

Thank You

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @Anonymous,

A good way to do this is to create a context variable when some action is true.  The action would be in the OnChange property of the Dropdown control.  Set the OnChange to If(Dropdown1.Selected.Value="yourvalue", UpdateContext({var:true}),UpdateContext({var:false})).  Then set the Button's DisplayMode property to If(var,Edit,Disabled).  Similarly, you can use the context variable "var" to hide or show labels and textboxes by setting the Visible property to var.  

View solution in original post

2 REPLIES 2
Drrickryp
Super User
Super User

Hi @Anonymous,

A good way to do this is to create a context variable when some action is true.  The action would be in the OnChange property of the Dropdown control.  Set the OnChange to If(Dropdown1.Selected.Value="yourvalue", UpdateContext({var:true}),UpdateContext({var:false})).  Then set the Button's DisplayMode property to If(var,Edit,Disabled).  Similarly, you can use the context variable "var" to hide or show labels and textboxes by setting the Visible property to var.  

santhoshkumard
Frequent Visitor

@Anonymous @Drrickryp 

The easiest thing to do is to go to the button's display mode and set that with the condition like this
No need to use a context variable!!

 

 

If(is_vaccinated_dropdown_input.SelectedText.Value = "No", DisplayMode.Disabled, DisplayMode.Edit);

 

 

 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (3,024)