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 / Reset toggle control i...
Power Apps
Unanswered

Reset toggle control in component

(0) ShareShare
ReportReport
Posted on by 27

Hello,

 

For the sake of simplicity, my PowerApps component contains a text input control and a toggle control. Two instances of the component are inserted in a screen.

What I would like help with is how to set both toggle controls to false with one button. Otherwise, "false" is the default parameter of the toggle in the component setup, so somehow a reset would be the goal.

 

Thanks,

Zoltan

 

kzoltan_0-1692041215432.png

 

Categories:
I have the same question (0)
  • graeme_findlay Profile Picture
    47 on at

    @kzoltan 

     

    You can use the reset function for OnSelect of your button

     

    Reset(Toggle1);Reset(Toggle2)

     

    graeme_findlay_0-1692042437852.png

     

     

     

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi,
    Alt, you can create 2 variables on the button like such (onselect):

    Set(var1, false);
    Set(var2, false);

    and then set the default property on toggle 1 to "var1" and toogle 2 to "var2".

    Devvj_0-1692042511997.png

     

    Devvj_1-1692042538949.png

     

     

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

  • kzoltan Profile Picture
    27 on at

    Thanks for the replies.

    The toggle is part of the component, not a standalone control. I assume that something needs to be set in the custom properties.

     

    kzoltan_0-1692082310544.png

     

  • Verified answer
    graeme_findlay Profile Picture
    47 on at

    Ah, ok @kzoltan ,

     

    I think this solution is what you’re looking for in that case

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Reset-controls-within-a-component/m-p/1589432#M407501

  • hasnainhaider68 Profile Picture
    47 on at

    Dear,

    you should try this

    1. Create a Reset Button: Add a button control to your PowerApps screen. This button will be used to trigger the reset action for both toggle controls.

    2. Set the Reset Button's OnSelect Property: Select the reset button, and in the formula bar or the "OnSelect" property of the button, add the following formula:

      UpdateContext({ResetToggle: true})
      UpdateContext({ResetToggle: false})
      This code snippet first sets the "ResetToggle" context variable to true, and then immediately sets it back to false. This will trigger a recalculation of the "ResetToggle" variable and cause the toggle controls to reset.

    3. Update the Toggle Controls' Default Properties: For each of the toggle controls in your component, you will need to update the "Default" property to take into account the "ResetToggle" variable. Assuming your toggle control's default property is currently set to false, you can modify it as follows:
      If(ResetToggle, false, YourOriginalDefaultValue)

  • kzoltan Profile Picture
    27 on at

    Thanks @graeme_findlay  and @hasnainhaider68 

    This was the key:

    "UpdateContext({ResetToggle: true})
    UpdateContext({ResetToggle: false})"

     

    It does not work with a single line.

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