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.

View solution in original post

6 REPLIES 6
hpkeong
Level 10

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.

View solution in original post

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=" "})

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
thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,290)