Multi-select options in a search form

By: Chris Rousseau | Asked: 05/01/2024
ForumsCategory: General questionsMulti-select options in a search form
Chris Rousseau asked 2 months ago

Hi there,  FF newb here.

I'm trying to implement a search form in a view that will allow the user to select from 4 search fields, and each of them has multiple pre-populated values as Lookup fields.  This works great when I only select one option from each search field, but if I try to select more than one value in any field, I get no search results back.

I triple-checked the data entries were created correctly so that if I select 2 values in one dropdown, I should see results.  At first I tried a data entry form and search fields using a dropdown multi-select which didn't work.

Now I am trying this with checkboxes, but I get the sense this won't work either because the URLs for the search concatenate each value so that one string of all values for that field is matched (and fails).

Any advice for how, if it's possible, to allow multi-select fields in a search form, either checkboxes or multi-select dropdowns?

Any help much appreciated! 

1 Answers
Bobby Clapp answered 2 months ago
When you have a list of values it creates problems. Check this example on tackling that:
Chris Rousseau replied 2 months ago

Thanks Bobby, we don't have access to the codebase on our end, though we could potentially add this in a child theme. It sounds like we would only be able to use one selection item per dropdown or checkbox otherwise.

Would something like "Set up Multiselect Cascading Fields" potentially work in a search form with a results view re

I'm not seeing how that would work with a View because it seems like there would be the same issues parsing the search URL with checkbox fields that requires the code link you included.

Bobby Clapp replied 2 months ago

You would need something special to do this, like the link I posted, for any generated list type of values to be able to cycle between each element of the list and search them individually. Many of us use snippet plugins to be able to add custom code as not to hook into the native themes or functions of wordpress. Maybe you can get someone to add that in for you?

Chris Rousseau replied 2 months ago

<p>Thanks again Bobby, we may be able to do this in a custom plugin which is probably our best option. Your reponses have been really helpful so I can let the stakeholders know we can't do this out of the box with multi-selection options in a search.</p>

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