cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Biisorte
Helper II
Helper II

Clear default textbox value when selected

Good evening,

 

I have a textbox with a default value, but if the value it's not correct, the user could change it.

What I want is if the user has to change the value, when he select the textbox the default value should disappear automatically. Now it's necessary to delete manually the default value and write the new one.

 

It's possible to do that?

I've tried with the Onselect property of the textbox and the blank() or Reset () function, but when I select the textbox it doesn't do anything...

 

Thanks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Biisorte ,

 

Do you mean you want to clear the TextInput box when you select it? How about the Clear function of TextInput box?

Snipaste_2020-04-08_10-24-41.png

Please set the Clear property of TextInput box to true to enable the clear function.

Hope this helps.

Sik

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@Biisorte 

Yes, you can.  As a demonstration of the technique try this:

 

Put this code in the OnVisible property of your screen

UpdateContext({myText: "Text You Want To Show"})

 

Use this code in the OnSelect property of your TextInput

UpdateContext({myText: ""})

 

Finally, change the Default property of the TextInput to

myText

 

 

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

eka24
Super User
Super User

The workaround would be:

1. OnVisible of the Screen, set a variable:
   Set(MyReset,1)

2. Insert a button and a another textbox1

3. On the Button Onselect put: Set(MyReset2,MyReset+1)

4. In textbox1 default put: MyReset2

5. In your TextBox default, change the formula to:

  

If(Value(textbox1.Text)>1," ",PutYourDefaultValueHere)
 
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.


  

Thank you for your responses,

 

unfortunatelly, this solutions don't fit to me, because the default values are taken from a Sharepoint list, so I can use a variable to put the "" value.

I can't use either a button, because it's not viable to insert one button in each textbox.

 

I don't know why I cannot set the OnSelect property of the textbox to "". It would solve my problem...

 

Any other idea?

v-siky-msft
Community Support
Community Support

Hi @Biisorte ,

 

Do you mean you want to clear the TextInput box when you select it? How about the Clear function of TextInput box?

Snipaste_2020-04-08_10-24-41.png

Please set the Clear property of TextInput box to true to enable the clear function.

Hope this helps.

Sik

Thank you Sik,

 

it's not the perfect solution, because you have to press de X button to clear the textbox, but if it's not possible to clear it when selected, it would work for me.

 

Thanks a lot for your time and our patience with me 😉

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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