Problem when i run search form

By: Chris Harrison | Asked: 02/25/2023
ForumsCategory: General questionsProblem when i run search form
Chris Harrison asked 2 years ago
  I create the search form and i combined with the view, but when i press search button  i always get the answer  "No Entries Found" till i refresh the page.. Then i get the filtered values view.  
chinya stanechinya stane replied 6 months ago

Hello,
It seems there's a glitch in the search functionality as it's displaying "No Entries Found" until the page is manually refreshed. Check the code to ensure the search feature accurately filters results without needing a page reload.

3 Answers
Walter JonesWalter Jones answered 2 years ago
Is your form being submitted with Ajax?  If so turn that off.
Chris Harrison replied 2 years ago

No is already off

Victor Font answered 2 years ago
In order for a search to work, a SQL query must execute on your server to return the result set for the view. This means that before you hit submit, views will always show "No entries found" until the search query is executed on the server. To see the result, you must refresh the page. The way to prevent seeing "No entries found" is to use two pages for your search. The first page only has the search form. When you submit the search criteria, the search form redirects to the second page that has both the search form and view. You'll only see filtered results this way provided you've created the filter properly in the view.
Chris Harrison replied 2 years ago

Why to create 2 pages ?
So far i was working perfect with just one page?

Can you give me a solution to have one page pls.

Victor Font replied 2 years ago

You can certainly use one page, but you'll need to write custom code. I shared with you what has become a best practice, because many Formidable users may not have the skill yet to develop the custom code required to use one page, but that doesn't seem to be an issue for you. Here's what you have to do:

Hide the view with CSS before the search form submits, and display the view with CSS after the search form runs. This means you have to develop code to track the form's state. You could use browser storage to do this.

You can also use browser storage to save/restore the search criteria so users don't have to re-enter their selections after a page refresh. This is what I do with the search for the Formidable Masterminds Developer Directory: https://formidable-masterminds.com/developers-directory/

Chris Harrison replied 2 years ago

I fix the problem
Now it works as before, perfect i can say
And All in one page

Thanks

rahcel yang replied 7 months ago

Hello Chris! I have run into the similar problem, but my problem is '"No Entries Found' even after I refresh, can you tell me how youfix the problem? THX

Michael ClarkMichael Clark answered 6 months ago
Sometimes server and browser caching plugins will cause weird stuff with things that need to refresh data sets, like searching and updating entries. I set explicit "don not cache" rules on some pages with forms and views. Seems to clear up issues like this.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right