The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Ignore non-filled out fields in Search Form

Labels

This Discussion is public

Notifications

I have built a search form that searches entries created from another form.

I have: one form that adds entries and the other searches those entries.

It works, but I want to allow a search so that not all fields need to be filled out.

So non-filled out fields would either be ignored or search all the options in that field.

e.g., if the search didn't select a country, then it would be ignored or search all countries. Currently, you need to choose a country and it will match that country, but a search may want to search all countries. I want people to be able to search all countries by leaving that field blank and get results from all countries.

So my current search form is too specific and I want users to only search on the fields they fill in or select and still get a result without exactly matching all fields.

Currently they have to select or type in all fields and there has to be an exact match to get a search result. This is too limiting and specific.

e.g.,

Name:
Industry:
Country:

I want to allow the user to search say just the Name and the Industry and Country would default to all industries and countries. If they didn't fill out anything then show all entries rather than be specific and show no entries.

I think I am making headway. Introduced "if"in the search URL:

http://blahblahblah.com/search-results? [if 107]&role=[107][/if 107][if 126]&functions=[126][/if 126][if 111]&company=[111][/if 111] etc
(Ignore the space after ? I have no space in the form)

This way if a field is left blank in the search form it won't be included (I believe). There are a number of dropdown lists in the search form though. I had originally removed the first option (blank), but put them back to allow them to not have a default option so they don't have to be filled out as well.

But still get: "No Entries Found" even when correctly inputting text/selection option inĀ one field which I know is the value in Entries.

No matter what, I get "No Entries Found".

But if I fill out all entries correctly, I do get a result. So it is not ignoring fields not filled out.

 

 

If this is too hard to understand, then this will make it simple.

How do I get all entries to show up in search results if nothing is put into the Search form when you perform a search? i.e., Includes all rather than narrowing the results to zero.

Discussion closed.