cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Changing toggle button on selection of another button.

I would like change the toggle button on selection of another button. I know you can make use of UpdateContext(Var: !Var) and set the default value of toggle switch to Var. But I need the toggle switch default value to remain Parent.default because that value is read from SP list upon item selection.

 

Any suggestions?

3 REPLIES 3
Highlighted
Responsive Resident
Responsive Resident

Re: Changing toggle button on selection of another button.

Could you not use multiple variables? The first one is used to flag whether you want the default value to be taken from the sharepoint list, the second one to be the value you want the toggle to show when the first is false?

 

For example, in the OnVisible of the page, have a statement declaring a variable: UpdateContext({isChange : false}). You can also declare another variable which will take the value from your sharepoint list with UpdateContext({myValue : DefaultSharepointValue})

 

From here, set the Default property of your toggle to a conditional statement with something like: If(isChange, myValue, DefaultSharepointValue)

 

You can then have it so that when the button is selected, it changes the isChange value to true and also inverts the value of myValue using UpdateContext({ myValue : !myValue, isChange : true})

 

You can then reset the toggle value to the sharepoint list by using UpdateContext({isChange:false}) anywhere you feel necessary

Highlighted
Helper I
Helper I

Re: Changing toggle button on selection of another button.

That makes sense!

Is there a way to set the value of toggle to true without making use of variables?

Highlighted
Community Support
Community Support

Re: Changing toggle button on selection of another button.

Hi @Andries1 ,

 

Currently, the variable could be the best approach to modify the property dynamically because we should define the corresponding properties in the formula bar of the respective properties. 

Best regards,

Sik

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

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

Top Solution Authors
Top Kudoed Authors
Users online (9,179)