cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
langsem
Post Patron
Post Patron

Make a search button

Hello i have an application that has 1 input field 
1 button and a gallery. 

I have made a actions that says that show images in the gallery based on what the user types in the Input field. Problem its that this  happens real time, so i want to move the trigger to the button. 

The user types in text into the inputfield then hit the button then the result will show in the gallery. How can i move the trigger to happend when the user hits the button ? 

1 REPLY 1
RandyHayes
Super User
Super User

@langsem 

PowerApps evaluates all formulas in real time.  So, if your Gallery Items property is doing a search based on the text in the TextInput control, then it will evaluate as someone types.

 

In order to do a "click to search", you need to take a snapshot of the value in the TextInput control.  In PowerApps, you can snapshot a value by using a variable as it will not change until you change it.

 

So, for example, in your button, set a variable to the textinput value: UpdateContext({searchTerms:TextInput1.Text})

And then change your Items property on the Gallery to utilize the searchTerms variable instead.

So, not knowing your control names or formulas, substitute the above with the proper textinput control name and then in your Items formula, replace TextInput1.Text (or whatever you called that control) with searchTerms

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (3,774)