Skip Navigation

[Resolved] Search posts using select box and text search

This support ticket is created 5 years, 4 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 6 replies, has 2 voices.

Last updated by davidm-13 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1322491

Tell us what you are trying to do?
I want to search posts by 2 taxonomies the first using a select box, then search all selected posts using a text search on 2nd taxonomy.
The text search alone appears to work, but I cant use the Select box to select posts from 1st taxonomy.
this is what I have:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
	<label>[wpml-string context="wpv-views"]Systems[/wpml-string]</label>
	[wpv-control-post-taxonomy taxonomy="system" type="select" default_label="Select all or click to specify" url_param="wpv-system"]
	<label>[wpml-string context="wpv-views"]Search Medicinal Complaints & Other Uses[/wpml-string]</label>
	[wpv-filter-search-box placeholder="Enter terms you wish to search for eg. cough" output="bootstrap"]
</div>
[wpv-filter-submit name="Search" type="button" output="bootstrap"]
[/wpv-filter-controls]
[wpv-filter-end]

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/front-page-filters/?utm_source=viewsplugin&utm_campaign=views&utm_medium=edit-view-create-custom-search-helpbox&utm_term=Creating%20custom%20searches%20with%20Views
Is there a similar example that we can see?

What is the link to your site?
hidden link

#1322771
system-tax.JPG

Hello,

Thanks for the details, I have tried it in the URL you mentioned above, but I don't see the same problem:
cant use the Select box to select posts from 1st taxonomy.

It works fine, see screenshot system-tax.JPG

Is this problem resolved?

#1322975

Hi Luo, Thanks for taking a look at this.
No it's not solved - firstly the Select box should show a list of around 30 biological systems from which I can select 1 system or all systems if I don't make a selection.
After selecting 1 or all systems, I want to enter complaint/use terms for the text search and return all posts that satisfy the system and complaint/terms specified.
Can be I'm missing a reset/clear button, but it's not behaving as I want.
Thanks for your help
David

#1323215

I've added a Reset button, problem is pressing it loads all the posts into results section.
Clicking Reset button needs to return an empty set, this should also happen on the initial page load.
I only want to see the returned posts when I click Search button.
Thanks for your help
David

#1323633

ok , I understand that the reset button only clears the filters and therefore also loads all the posts without the filters. I have over 1200 posts that I search so loading them all is very time consuming.
I want the search filters - a select dropdown and a text search - and the results on the same page.
Is there a javascript function to clear the filters and all results, so that I have a blank search form?
Would it be possible to include a value in the select dropdown that doesn't return any results?

Thanks for your help
David

#1324023

Thanks for the details.

Q1) firstly the Select box should show a list of around 30 biological systems
Please edit the post view (ID: 11949)
In section "Custom Search Settings", enable option "Let me choose individual settings manually", enable option "Always show all values for inputs".

If you don't find section "Custom Search Settings", please click link "Screen Options", there is an option "Custom Search Settings".

Q2) Is there a javascript function to clear the filters and all results, so that I have a blank search form?
No, there isn't such kind of built-in feature, I suggest you try with one of below options:
1) Add pagination into your view:
https://toolset.com/documentation/user-guides/views-pagination/

2) Split the search form and search result into two different pages, see our document:
https://toolset.com/documentation/user-guides/front-page-filters/#4-1-adding-the-custom-search-form-to-a-page-or-widget
section "4.1. Adding the custom search form to a page or widget"

Q3) Would it be possible to include a value in the select dropdown that doesn't return any results?
Same as above Q2), there isn't such kind of built-in feature.

#1326759

My issue is not resolved now. Thank you!