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)

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,576)