Skip Navigation

[Resolved] begin search query as soon as user leaves field

This thread is resolved. Here is a description of the problem and solution.

Problem:

I am trying to speed up the search of my view, and am wondering if it is possible to implement such a jQuery snippet of code to tell the database to begin searching through the database as soon as a user leaves the input field.

Solution:

There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example, when event "onfocusout" is triggered, you can submit the search form with jQuery submit(), see jQuery document:

https://api.jquery.com/submit/

Relevant Documentation:

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by simchaH 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2310659

Hi,

I am trying to speed up the search of my view, and am wondering if it is possible to implement such a jQuery snippet of code to tell the database to begin searching through the database as soon as a user leaves the input field.

I found online this: https://stackoverflow.com/questions/38791919/call-a-function-after-leaving-input-field , it doesn't have anything to do with calling a DB query, but it does show there is an onfocusout() function. I am just trying to figure out if this is usable by saying "begin the filtering process, onfocusout"

Thanks,
Sim

#2311027

Hello,

I assume we are talking about Toolset Search form.
There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example, when event "onfocusout" is triggered, you can submit the search form with jQuery submit(), see jQuery document:
hidden link

#2314449

We're talking about the search bar that I added to my view/loop. Is the only option to utilize the jQuery submit() function? Because I don't know if that'll be a solution since the user may want to add more filters to the search. Rather, I need a function that will just start querying what was entered into the search field. (The field in question is the Post Title field, and it is an input text type). Do you know of any kind of function offhand? I tried Googling but came back with nothing.

Thanks!

#2315867

Unfortunately, there isn't such kind of function offhand with Toolset plugins, you can also Toolset Contractors for it:
https://toolset.com/contractors/

#2316385

My issue is resolved now. Thank you!