web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Clear default textbox ...
Power Apps
Unanswered

Clear default textbox value when selected

(0) ShareShare
ReportReport
Posted on 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,

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @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 Profile Picture
    20,923 on at

    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.


      

  • Biisorte Profile Picture
    83 on at

    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?

  • Verified answer
    v-siky-msft Profile Picture
    on at

    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 at

    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 😉

     

  • kevinjeronne Profile Picture
    on at

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard