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

Unable to clear/reset label.Text through button click

Hi,

I have a label's .Text property set to User().Email to display the user's email address when the screen is active. Next, I have a button that, among other things, should reset the label's .Text property to "". Unfortunately, I'm unable to accomplish this. I know how it works with text input fields (reset or updateContext) but can't figure out how to do this with labels.

 

I tried an if-statement like: If(button_1.pressed, "", User().Email) but that didn't work.

 

Thanks for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Unable to clear/reset label.Text through button click

Hi,

 

You could use a context variable to set the Label.Text property:

 

  • On the OnVisible property of your screen, set the variable : UpdateContext({LabelValue:User().Email})
  • On the Text property of your Label to the value of the context variable : LabelValue
  • On the OnSelect property of your button, update your context variable : UpdateContext({LabelValue:""})

Cheers,

Théo

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Unable to clear/reset label.Text through button click

Hi,

 

You could use a context variable to set the Label.Text property:

 

  • On the OnVisible property of your screen, set the variable : UpdateContext({LabelValue:User().Email})
  • On the Text property of your Label to the value of the context variable : LabelValue
  • On the OnSelect property of your button, update your context variable : UpdateContext({LabelValue:""})

Cheers,

Théo

View solution in original post

colonel_claypoo
Level: Powered On

Re: Unable to clear/reset label.Text through button click

Excellent. Thank you, that worked. I just had to reload the app otherwise the 'OnVisible' for Screen1 was not working and the User().Email property would not show in the label.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,776)