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

Clearing text in labels using a button

Hello PowerApps Community,

 

I have an app that has some button functionalities that update labels. I have 2 buttons, Start_time_button and End_time_button (label names). Start Time variable is stt and End Time variable is ett.

 

I want to set the Now() time in Start time label and clear the End time label when I click on Start_time_button. I used Set(ett, Now()) to set the time for both labels and it works. However, I am not able to clear variable ett. I tried UpdateContext syntax but it constantly clears the ett label and I cannot update it with the End_time_button. 

 

I also want to disable the Submit button if either label is blank. I am not sure how to do that. I used If(IsBlank(ett),DisplayMode.Edit,DisplayModeDisabled) but it did not work. 

 

EDIT:

End time label - 'ett_label'

Start time label - 'stt_label'

 

Any help is appreciated and I can provide more context if needed. 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User III
Super User III

@BubbleGhost 
Have you tried setting ett to Blank?

Set(ett, Blank())



---
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

Pstork1
Dual Super User III
Dual Super User III

Use the following for the Start Time button

Set(stt, Text(Now(),DateTimeFormat.ShortDateTime));Set(ett,"")

and this for the End Time button

Set(ett, Text(Now(),DateTimeFormat.ShortDateTime))

and this in the DisplayMode of the Submit button

If(IsBlank(ett) || IsBlank(stt),DisplayMode.Disabled,DisplayMode.Edit)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

14 REPLIES 14
JR-BejeweledOne
Super User
Super User

Please share your End time label text formula and the default formula.    What are the names of your start and end time labels?

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

End time label - 'ett_label'

Start time label - 'stt_label'

 

There is no default formula on either label. The OnSelect function is 'false' for both labels.

mdevaney
Super User III
Super User III

@BubbleGhost 
Have you tried setting ett to Blank?

Set(ett, Blank())



---
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

It was that simple? I feel dumb. That solution worked. 

Pstork1
Dual Super User III
Dual Super User III

Use the following for the Start Time button

Set(stt, Text(Now(),DateTimeFormat.ShortDateTime));Set(ett,"")

and this for the End Time button

Set(ett, Text(Now(),DateTimeFormat.ShortDateTime))

and this in the DisplayMode of the Submit button

If(IsBlank(ett) || IsBlank(stt),DisplayMode.Disabled,DisplayMode.Edit)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

On the Onselect of the ett botton:

Set(ett, Now())
 
On Another Button
UpdateContext({ClearVar:!ClearVar})
 
In Your Textbox
If(ClearVar,"",ett)
 
on the displaymode:
If(IsBlank(Lable1.Text),DisplayMode.Edit,DisplayModeDisabled)
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
 

@BubbleGhost 
Don't feel bad.  Its something that must be learned.  No one expects to use the Blank() function where they start out.  I failed many times before I got good.  

I tried your solution for the Submit button but it is staying enabled in all conditions. It is not disabling when ett is blank.

I tried your Submit button solution but it is staying enabled in either condition. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (56,465)