web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / When ComboBox option s...
Power Apps
Answered

When ComboBox option selected in a form control, Visible property is toggled true/false for controls in another form.

(0) ShareShare
ReportReport
Posted on by 31

Hi All,

 

I'm a semi-newbie by now, which means I know just enough to be dangerous. 

 

At any rate, the title sort of says it all.

 

I have a form ("Form1") with controls that are visible according to their designation ("Level2" and "Level3" in my case.)

 

I have another form ("Form2") on the same screen with a ComboBox control such that when it shows "Level2" as the option selected, only a certain set of controls in Form1 will be visible to the user. 

 

If "Level3" is selected, the user will see a different set of Form1 controls.

 

Here's what I've done so far:

I set a variable "varLevel2," on the Visible property of the Form1 controls that I want to be visible when "Level2" is selected in the Form2 combobox.

 

Likewise, I set a variable "varLevel3," on the Visible property of the Form1 controls I want to be visible when "Level3" is selected in the Form2 combobox.

 

On the OnChange* property of the Form2 combobox, I've used:

 

Set(

   varLevel2, If(Form2ComboBox.Selected.Value = "Level2", false

);

Set(

   varLevel3, If(Form2ComboBox.Selected.Value = "Level3, false

   )

  )

)

 

*The reason I used the OnChange property is because the value ("Level2" or "Level3") is set by a drop-down control in another screen)

 

The problem is that it only sort of works.

 

If let's say I select "Level2" in the Form2 combobox, then the Form1 controls whose Visible property I've set as varLevel2 are displayed OK.

 

But when I select "Level3" in the Form2 combobox, the fields with varLevel3 in their Visible property display alright, but the Level2 controls remain visible as well. 

 

What I want is the Form1 Level2 controls to have the visible property be false when "Level3" is selected in the Form2 combobox, and vice versa.

 

I sense that I'm close to the solution, but I'm not seeing the forest for the trees.

 

Any assistance would be greatly appreciated.

 

Many thanks.

Categories:
  • Verified answer
    TheRobRush Profile Picture
    11,128 Moderator on at

    Assuming their associated variable should be false when they are selected, and true when they are not, try this in the OnChange

     

    Switch(
     Form2ComboBox.Selected.Value,
     "Level2", Set(varLevel2,false); Set(varLevel3,true),
     "Level3", Set(varLevel2,true); Set(varLevel3,false),
     Set(varLevel2,true); Set(varLevel3,true)
    )
  • SatxThree Profile Picture
    31 on at

    That was it! 

     

    My apologies for not being really clear at first. Their associated variable should be true, not false, when they are selected, and false, not true, when they are not.

     

    But it's no problem! I changed "false" to "true," and vice versa in the formula and it works perfectly.

     

    Thank you for turning me on Switch! 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard