cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KevHouston
Frequent Visitor

Setting a field's value based on a toggle selection

Within a SharePoint list form modified in PowerApps, I have a toggle, Toggle1.

 

I would like to set the value of a text field 'PWA', when the toggle field is False. 

 

How would I do this please?

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@KevHouston 
Create a variable to hold the value you want to set in the TextInput_PWA in the OnVisible property of the screen

Set(myDefaultValue, "")


Put this code in the OnUnCheck  property of the toggle

Set(myDefaultValue, "your text here")
Set(myResetDefault, true); Set(myResetDefault, false)

 

Then put this code in the Default property of the text input

myDefaultValue

 

And this code in the Reset property of the text input

myResetDefault

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

3 REPLIES 3
mdevaney
Super User
Super User

@KevHouston 
Create a variable to hold the value you want to set in the TextInput_PWA in the OnVisible property of the screen

Set(myDefaultValue, "")


Put this code in the OnUnCheck  property of the toggle

Set(myDefaultValue, "your text here")
Set(myResetDefault, true); Set(myResetDefault, false)

 

Then put this code in the Default property of the text input

myDefaultValue

 

And this code in the Reset property of the text input

myResetDefault

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Thanks for the response and details @mdevaney 


Having slight issues.

On the OnUncheck fx of the Toggle, I am entering as you listed;

Set(myDefaultValue, "your text here")
Set(myResetDefault, true); Set(myResetDefault, false)

KevHouston_0-1593006381752.png

 

 

Do I need to add a , or & or &&? Sure its simple on how the two lines act together, but cannot figure it out. It doesnt like with I add & or a comma.

Do I not need to declare the myResetDefault variable initially?

 

@KevHouston 

You need to separate the lines with ";"

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,371)