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 / Change toggle value ba...
Power Apps
Answered

Change toggle value based on dropdown menu item is selected.

(0) ShareShare
ReportReport
Posted on by 426

HI,

Can someone help me with this. I have a a yes no toggle and i wish to turn the toggle to yes if the drop menu is selected as "employee". You can refer to the attached screenshot i have.

how to move toggle based on menu item.jpg
Categories:
I have the same question (0)
  • Dawidvh Profile Picture
    1,346 on at

    Hi @nchandran 

     

    The drop down seems to be a combobox. A radio button might work better here if there are only a few options. You can set the default of the toggle to something like

    ComboBox.Selected.Value = "Employee"

    Let me know if you don't come right.

     

    Dawid van Heerden
    Follow on Twitter: @davestechtips
    Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
    **If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.

     

  • Verified answer
    KnoxLam Profile Picture
    30 on at

    Hi @nchandran ,

     

    If you are strictly sticking to the toggle control with the combobox, you can try this:

     

    In the OnSelect and OnChange properties of the combbox, type the following:

     

    UpdateContext({ToggleReset:false});
    If(
    ComboBox1.Selected.Value = "Employee",
    UpdateContext({ToggleDefault:true,ToggleReset:true}),
    UpdateContext({ToggleDefault:false,ToggleReset:true})
    )

     

    *ComboBox1 is the name of the drop down control, you should change it to the name of your combobox.

     

    Next, set the Default property of the toggle control to ToggleDefault and the Reset property to ToggleReset.

     

    How it works:
    We use the ToggleReset and ToggleDefault context variables to control the properties of the toggle button.

     

    The Default property of the toggle control defines the default value of it (true or false)

    The Reset property defines if the control should be reset to its default value. In case the user manually tapped the toggle control, we can use this property to reset the toggle control to its default value.

     

    On change or on select(to ensure the variables update) of the combo box control, we first set the ToggleReset value to false. Next, depending on the selected value of the combo box, we set the ToggleDefault to true or false and set ToggleReset to true (this triggers the toggle control to reset its value to Default, which we defined with ToggleDefault)

     

    Hope it helps.

  • nchandran Profile Picture
    426 on at

    Thank you that was awesome!!


    @KnoxLam wrote:

    Hi @nchandran ,

     

    If you are strictly sticking to the toggle control with the combobox, you can try this:

     

    In the OnSelect and OnChange properties of the combbox, type the following:

     

    UpdateContext({ToggleReset:false});
    If(
    ComboBox1.Selected.Value = "Employee",
    UpdateContext({ToggleDefault:true,ToggleReset:true}),
    UpdateContext({ToggleDefault:false,ToggleReset:true})
    )

     

    *ComboBox1 is the name of the drop down control, you should change it to the name of your combobox.

     

    Next, set the Default property of the toggle control to ToggleDefault and the Reset property to ToggleReset.

     

    How it works:
    We use the ToggleReset and ToggleDefault context variables to control the properties of the toggle button.

     

    The Default property of the toggle control defines the default value of it (true or false)

    The Reset property defines if the control should be reset to its default value. In case the user manually tapped the toggle control, we can use this property to reset the toggle control to its default value.

     

    On change or on select(to ensure the variables update) of the combo box control, we first set the ToggleReset value to false. Next, depending on the selected value of the combo box, we set the ToggleDefault to true or false and set ToggleReset to true (this triggers the toggle control to reset its value to Default, which we defined with ToggleDefault)

     

    Hope it helps.



    .

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard