Skip Navigation

[Resolved] Search page is yielding non sensical events after our last Toolset update

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

Problem: I would like to update my custom search filter so that the default option "all" or "any" is selected when the page first loads, rather than some other option.

Solution: Use the default_label attribute in the filter control shortcode to supply a meaningful default text label, or leave it blank:

[wpv-control-postmeta field="wpcf-town" type="select" url_param="wpv-wpcf-town" default_label="All towns"]

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta

This support ticket is created 5 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Robert Davies 5 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1362829

I am trying to: Look at an existing view. This is a form that filters a list custom type - Acquisitions to bring back specific items

Link to a page where the issue can be seen: hidden link

I expected to see: when I type in an Aquisition number to get 1 or a small number of items with the same acquisition number. Pick any item from the search results and you should be able to retrieve that item by its number

Instead, I got: Multiple results. A large number of which contain the number in the acquisition number

#1362967

Hi, it looks like the default values in the Town select field and the Buyer select field are being considered in the filter criteria. If you check the Query Filter, you can see that the comparison "OR" is used. That means if any of the filters match, the post will be shown in the results. So when I type "3" in the Acquisition number, the first result is:
Aquisition Number: 2
Title: Aux dames de France
Artist: BAYES,Walter
Location: Calderdale Metropolitan Borough Council
Town: -

The "Town" filter matches up here, even though the Acquisition number does not. So I'm not sure what should be done here because I'm not really familiar with the contents of the site. You can either add an empty default value in each select field, or you can be sure something legitimate is selected in each field. Let me know if you have questions about this.

#1363869

Hi Christian

Thanks for the looking into this
I think you're right that we may have an issue in the drop down filters

Would it be possible to let me know the best way to default these to an empty value

Thanks

Rob

#1365105

You can use the "default_label" option in the filter shortcode to define an empty value. For example, you can add a blank space like this:

[wpv-control-postmeta field="wpcf-town" type="select" url_param="wpv-wpcf-town" default_label=" "]

Or you could use a meaningful text label instead of a space, like "Any Town" or "All Towns".

#1367911

My issue is resolved now. Thank you!