Skip to main content
Community site session details

Community site session details

Session Id : tvSypiSwG8mSCyvW9Lmj3P
Power Apps - Building Power Apps
Answered

Clear default textbox value when selected

Like (0) ShareShare
ReportReport
Posted on 7 Apr 2020 10:52:43 by 83

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,

 

  • kevinjeronne Profile Picture
    on 20 Jan 2024 at 15:58:14
    Re: Clear default textbox value when selected

    thank you. 
    this is the exact use case I was looking for.

  • Biisorte Profile Picture
    83 on 09 Apr 2020 at 10:44:51
    Re: Clear default textbox value when selected

    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 😉

     

  • Verified answer
    v-siky-msft Profile Picture
    on 08 Apr 2020 at 02:26:39
    Re: Clear default textbox value when selected

    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

  • Biisorte Profile Picture
    83 on 07 Apr 2020 at 14:18:54
    Re: Clear default textbox value when selected

    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?

  • eka24 Profile Picture
    20,921 on 07 Apr 2020 at 12:12:36
    Re: Clear default textbox value when selected

    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.


      

  • mdevaney Profile Picture
    29,987 Moderator on 07 Apr 2020 at 11:54:35
    Re: Clear default textbox value when selected

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete