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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change toggle value ba...
Power Apps
Unanswered

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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard