cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Andries1
Level: Powered On

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
chrisog
Level 8

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

Andries1
Level: Powered On

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?

Microsoft v-siky-msft
Microsoft

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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