Skip Navigation

[Resolved] Custom Search With Checkbox

This support ticket is created 5 years, 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by chrisB-30 5 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1254871

Hello,

I just created a custom search function for my site:
hidden link

It was working great until I added the "Religion" choice.

This is based on a "Select" custom field:
hidden link

I tried adding an "Any" option and making it the first selection so "Any" would appear when the user first hits the page.

But it looks like Toolset is now looking ONLY for entries tagged with ANY - which none of them are - it is just a stand-in selection. So the search results are always blank unless I hit the reset button.

Is there a workaround for this? I would like the Religion field to have no effect on the search results unless the searcher specifically sets the option.

Also

After scouring the support forums I'm pretty sure the answer to this is "it is not possible" but I'll ask anyway.

Is there a way to set a default view for when the user first hits the custom search page. Currently, all my profiles are displaying - which makes the page load slow.

Thanks!

#1254925

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - first of all, if you want to display the default option what if you try to set radio button available with the "Any" row and set it to default (checkmark) it.
=> hidden link

Is there a way to set a default view for when the user first hits the custom search page. Currently, all my profiles are displaying - which makes the page load slow.
==> Sorry, I do not get your question. Do you mean that you do not want to display any results when page loaded first and only display results when user click search button?

#1254945

Hello,

Setting the default option is not the issue. If I set "Any" as the default option for the Religion field Toolset will still be looking for Profiles that have the "Any" choice selected for the Religion field.

There are 0 profiles with the "Any" checkbox selected - the only reason I created this option is so the word Any will show when the searcher comes to the page.

To demonstrate the problem
Go here - hidden link
Now type "gym" in the search by keyword field

You will get 0 results because toolset is looking for profiles with the keyword "gym" and that also have the "Any" checkbox checked. There are 0 profiles with "any' checked

Now hit reset and type gym again in the search box

You will now see many results because Toolset is not using Religion to filter the search.

I don't want the religion field to have an effect on the search results UNLESS the user selects a specific religion.

As for the second question - I would like to have some results displayed - but not ALL of my profiles - that is about 700 images that the page needs to load. Is there a way to limit the number of profiles the page loads to begin with? I don't see any pagination options for the search function.

Thanks

#1254975

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That means that you should remove the "Any" option from your custom field options list and when you try to add a new filter from "Search and Pagination" section or edit the existing filter, it will allow you to set the default option for your select dropdown.

you can add attribute default_label:

For example:

[wpv-control-postmeta field="wpcf-sezona" default_label="Please select one" type="select" order="none" url_param="wpv-wpcf-sezona"]
#1255549

That fixed it thanks!