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

Reset Search Text Box

I have a search text box where I added and X icon that changes visibility depending on the text in the search box.

 

for the X icon: If len(TextBoxSearch.Text)=0 visible false else true.

 

When the X is visible and th euser clicks on it, it should clear the contents of the search box but it is not working

 

OnSelect: TextBoxSearch.Clear; (not working)

OnSelect: TextBoxSearch.text=""; (not working)

OnSelect: TextBoxSearch.text=" ";TextBoxSearch.text=" "; (not working)

 

Please advise.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Level 10

Re: Reset Search Text Box

Hi @jmontoya,

@hpkeong is absolutely correct.  I actually prefer his suggestion 2. (but you need a button and not an icon; I don't think icons have a Pressed property).  But that is easy just place a button intead of the icon, make its text X and remove all border/background etc.

 

Also, there is a simpler alternative: text inputs have this x for clearing the contents.  Whether it appears in the control is regulated by the TextBoxSearch's Clear property (see here in the Clear entry), so you just need to set this to true.

 

However, the X generated by the clear property is not visible in all browsers and clients, at least in my experience.  This is a bug, but it should be fixed sooner or later.

6 REPLIES 6
Super User
Super User

Re: Reset Search Text Box

Hi

 

Tow Methods:

 

1. Button.OnSelect = UpdateContext({TextBoxSearch.text=" "}); UpdateContext({TextBoxSearch.text=""})

- first " " with space

- second "" no space

 

2. Alternatively, you may also use:

TextBoxSearch.Reset = Button.Pressed

 

Hope this helps.

hpkeong
Meneghino
Level 10

Re: Reset Search Text Box

Hi @jmontoya,

@hpkeong is absolutely correct.  I actually prefer his suggestion 2. (but you need a button and not an icon; I don't think icons have a Pressed property).  But that is easy just place a button intead of the icon, make its text X and remove all border/background etc.

 

Also, there is a simpler alternative: text inputs have this x for clearing the contents.  Whether it appears in the control is regulated by the TextBoxSearch's Clear property (see here in the Clear entry), so you just need to set this to true.

 

However, the X generated by the clear property is not visible in all browsers and clients, at least in my experience.  This is a bug, but it should be fixed sooner or later.

angelofleming
Level: Power Up

Re: Reset Search Text Box

The solution is to pass the name of the control that you want reset to the reset function.

Reset(TextInputName)

Anonymous
Not applicable

Re: Reset Search Text Box

Are you mad. "." is not supported inside UpdateContext({TextInput9.Text=" "})

Anonymous
Not applicable

Re: Reset Search Text Box

 "." is not supported inside UpdateContext({TextInput9.Text=" "})

Highlighted
Mühle
Level: Powered On

Re: Reset Search Text Box

 

Reset(SearchBox)

 

The text input will be cleared and will shown default value or hint text.

 

Also there is setting in properties of text input called "Clear Button". If you set this, the "X" button will be shown automatically.

 

Best regards

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 228 members 4,735 guests
Please welcome our newest community members: