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

Setting Condition for Field using Drop Down Box

Good day everyone!

 

I am trying to use a drop down to either keep a certain set of fields disabled or to enable editing/viewing for them. Here is what I have tried so far:

 

If(EndProjectDrop.OnSelect = "Yes", Explanation.DisplayMode.View, Explanation.DisplayMode.Disable)

 

There are a few other labels and text boxes that will need to change also depending on the Yes/No selection from the drop down box (NewSta1.DisplayMode.View/Disable, NewSta1Input.DisplayMode.Edit/Disable, etc.)

 

Any help would be greatly appreciated as the only way I can think to do this right now is using an IF statement. I have tried using this IF statement in the OnSelect action and also in the DisplayMode box of advanced properties.

 

Thank you and Happy Holidays!

1 ACCEPTED SOLUTION

Accepted Solutions

I just tested this on a dropdown box and an input box.

The dropdown is named Dropdown1 and the inputbox is TextInput1. The formula below works. You can modify it to reflect the names of your controls. In the DisplayMode control for the TextInput1 i entered the formula below.

 

If(Dropdown1.Selected.Value = "Yes", DisplayMode.Edit, DisplayMode.View)

View solution in original post

7 REPLIES 7
SeanTambling
Helper IV
Helper IV


 

If(EndProjectDrop.OnSelect = "Yes", Explanation.DisplayMode.View, Explanation.DisplayMode.Disable)

 

 

 


Change to:

If(EndProjectDrop.value = "Yes", Explanation.DisplayMode.View, Explanation.DisplayMode.Disable)

 

Don't think it works with .OnSelect

 

@SeanTambling- Thanks! Which field should I set that under then? Would it be the display mode field? Also, would I put that code in to the drop box control itself or the label?

 

Cheers!

Use that formula for any item/control you want to change the DisplayMode for, and yes, under DisplayMode.

Ok, so the error that comes with doing that shows invalid argument type for Explanation.DisplayMode. When I look at it in the formula bar, it says Explanation.DisplayMode = This data type is unsupported for evaluation. Data type: Enum. Can you think of another way of doing this by chance? Even if we set the mode to change for visible from true to false, that would work for me. I've tried using this formula with the variation of visible, and still throws errors.

I just tested this on a dropdown box and an input box.

The dropdown is named Dropdown1 and the inputbox is TextInput1. The formula below works. You can modify it to reflect the names of your controls. In the DisplayMode control for the TextInput1 i entered the formula below.

 

If(Dropdown1.Selected.Value = "Yes", DisplayMode.Edit, DisplayMode.View)

You are awesome... not sure why that wasn't working for me before, but all the errors went away and it started working as it should.

 

Thank you!

You may not have had the .Value at the end of DropDown1.Selected  , With out the .Value, it won't work

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,753)