I have created a toolset archive and added search fields for frontend search. And I kept the pagination of the archive to ajax infinite scrolling. Now when I provide any value in the input fields but don't press the submit button and go to the bottom of the archive to see more results with infinite scrolling, it automatically searches according to the new input value that I provided in the input field. So it shows different results. But it should provide results according to the past value of the input field because I didn't press the submit button. It is showing results according to the new value of the input fields. Is there any way to stop it?
Thanks for your contact! I'll be glad to help you 🙂
It is possible to achieve that behavior, yes. For this you'll need to:
- select the 'View Search' block
- find the 'Custom Search' metabox
- choose the second option for 'Form submit': AJAX refresh when clicking submit
- save the page and see if you'll have the desired results
Please check the following screenshot showing this step-by-step: hidden link
If something is not clear yet or it is not working properly, please let us know and we'll check it better for you.
Hi there,
Thanks for your answer. I checked my archive page and found that, the option is already enabled. The page does ajax refresh upon clicking submit. But the problem is still occurring. What else can I do?
Could you please show us where exactly the View and Search appear? Also, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Please, let me know if you need any additional details. Have a nice day.
Hi there. I am actually not comfortable in giving access to my developed website. Can you kindly give me a sandbox site where I can replicate the problem and show it to you?
I have created some posts and assigned them to some category terms. I also created a Home archive with Toolset where I used infinite scrolling. You can visit it here: hidden link
1. Go to hidden link
2. Don't scroll the page and select any checkbox in the Archive search
3. Now scroll the page for infinite scrolling
You will see that, the archive isn't showing any result. But it should show all the default results of the archive.
Thanks for your patience. Looking forward to your reply.
Thanks a lot for your efforts in doing the replication.
Upon further inspection, we have concluded that the question you've reported is actually an expected behavior. The reason behind it is that the 'submit' action sends a request to the server, which has collected info from the search filters and will be used in constructing the query. Then, the results (including the search filter values used to generate it) are passed to the browser. After the request is completed, the server knows nothing about the form search parameters. Every browser request needs to re-send them.
Then, we have a problem because going to the next page of results (pagination) is also a request to the server, and the request again includes details of the parameters to be used in the query, including the search parameters as well as which page of results to return. The only source for the search parameters is what's in the search form; what's in the form at the time of the request gets sent along with the rest of the request details.
A pagination request and clicking the submit button are functionally equivalent, both triggering requests to retrieve posts with whatever the current parameters are. Therefore, what we're experiencing in this archive is just the expected scenario and we can't avoid that.
I hope this explanation is clear to you and solves the question.