cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

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
Highlighted
Community Champion
Community Champion

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.

View solution in original post

6 REPLIES 6
Highlighted
Community Champion
Community Champion

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
Highlighted
Community Champion
Community Champion

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.

View solution in original post

Highlighted
New Member

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)

Highlighted
Anonymous
Not applicable

Re: Reset Search Text Box

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

Highlighted
Anonymous
Not applicable

Re: Reset Search Text Box

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

Highlighted
Advocate I
Advocate I

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,086)