cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate III
Advocate III

Toggle switch with another button OnSelect (on save) (SharePoint list)

How can I toggle a switch (or tick a checkbox) with another button?

 

I need a hidden Toggle (Yes/No), by default it's OFF. I want another button, that will toggle the switch to ON and then submits the form.

 

How can I achieve this?

 

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Toggle switch with another button OnSelect (on save) (SharePoint list)

@GrischkePro 

One quick way to do this is the use of a variable.

In your Button OnSelect action use a formula such as this:

   Set(setToggle, true)

 

Then on your Default property of the Toggle control, set this formula:

   setToggle

 

If you are using the toggle to then perform an action in the "OnCheck" action of the control, then do your formula, and then at the end, place a Set(setToggle, false) to reset the toggle back so that it can be "called" again.

 

This is a very useful pattern to do with toggle controls.  HOWEVER, there is one word of warning...

If you put your toggle control on another screen, you need to at least reference the Toggle Control on the screen where your button is.  You can do that simply enough with a non-visible label with the text property set to yourToggleName.Value

This will work perfectly from any screen (as long as you have a referencing "dummy label").

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Toggle switch with another button OnSelect (on save) (SharePoint list)

@GrischkePro 

One quick way to do this is the use of a variable.

In your Button OnSelect action use a formula such as this:

   Set(setToggle, true)

 

Then on your Default property of the Toggle control, set this formula:

   setToggle

 

If you are using the toggle to then perform an action in the "OnCheck" action of the control, then do your formula, and then at the end, place a Set(setToggle, false) to reset the toggle back so that it can be "called" again.

 

This is a very useful pattern to do with toggle controls.  HOWEVER, there is one word of warning...

If you put your toggle control on another screen, you need to at least reference the Toggle Control on the screen where your button is.  You can do that simply enough with a non-visible label with the text property set to yourToggleName.Value

This will work perfectly from any screen (as long as you have a referencing "dummy label").

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Advocate III
Advocate III

Re: Toggle switch with another button OnSelect (on save) (SharePoint list)

@RandyHayes 

 

This is brilliant! I was almost there, just didn't know where to apply the variable 🙂

 

FYI, I needed to toggle it "on save" without the user knowing about it, so that Flow knows what to do next 😉

 

Thank you very much! Smiley Very Happy

Highlighted
Frequent Visitor

Re: Toggle switch with another button OnSelect (on save) (SharePoint list)

Thanks this is very helpful

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,527)