cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
naijacoder
Helper III
Helper III

How to set the display mode of a dropdown when checkboxes are selected

Hi All,
I have 3 single checkboxes placed on a form and 2 dropdown lists.

 

What i want to achieve is when the form loads :-

 

1) I want to see the first check box  to be selected ( I have set the default to TRUE so this is good)
2) When this first box is selected i want to disable the 2 dropdowns by default .

I have set the property DisplayMode of the 2 dropdownx to the below
If(
'chk1'.Value = true,Disabled,Edit
)

 

If(
'chk2'.Value = true,Disabled,Edit
)


So thats all good.
My issue is i can't figure out what to do to enable back the 2 dropdown list and uncheck the first one when i select the chk3 which is the last check box?

When i add all the 3 conditions below at once to the DiplayMode property of the dropdowns i get an error  

If(
'chk1'.Value = true,Disabled,Edit
)

 

If(
'chk2'.Value = true,Disabled,Edit
)

If(
'chk3'.Value = true,Disabled,Edit
)


it seems the formula is wrong..
Hope someone can help

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @naijacoder ,

 

First modify the Default property of first check box to If(IsBlank(var1),true,var1)

Then set chk3.OnCheck property to Set(var1,false), and set chk3.OnUnCheck property to Set(var1,Blank())

 

Test Outcome:

GIF_102.gif

Hope this helps.

Sik

View solution in original post

5 REPLIES 5
v-siky-msft
Community Support
Community Support

Hi @naijacoder ,

 

First modify the Default property of first check box to If(IsBlank(var1),true,var1)

Then set chk3.OnCheck property to Set(var1,false), and set chk3.OnUnCheck property to Set(var1,Blank())

 

Test Outcome:

GIF_102.gif

Hope this helps.

Sik

View solution in original post

naijacoder
Helper III
Helper III

Thanks Sik.
When do you set var1 and var2  though?

v-siky-msft
Community Support
Community Support

Hi @naijacoder ,

 

Actually, I can't get your point. 

The var1 formula should be put into OnCheck and OnUncheck property of chk3, so when you check or uncheck the chk3, var1 definition will be changed.

 

Sik

Thanks Sik, What is var1?
Did you have to set that variable first somewhere?
If yes where should it be set?

v-siky-msft
Community Support
Community Support

Hi @naijacoder ,

 

Var1 is just a variable to control the chk1's Value(Default), if chk3 is unchecked, the var1 is blank, so chk1.Default outputs true, if chk3 is checked, chk1.Default outputs false.

There is no need for other extra settings, you should just follow my above steps to modify the OnCheck and OnUnCheck property of CHK3

 

Hope this helps.
Sik

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (13,042)