[Resolved] conditional filter display on parametric search
The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
Hello, i can correctly setup a conditional field on cred that appear if another field is chosen. For example:
I have a selectfield "how do you know about us" > agency-university-etc...
If i select "agency" appear another field "what agency" > agency1-agency2-etc
If i select "university" appear another field "what university" > university1-university2-etc
Until now everything ik OK
My question is
There is the possibility to do the same thing on parametric filtering?
I would to select filter "how do you know about us" and another filter appear accordingly
Firstly, please note that you are posting in the Community Forum for users of the free Types plugin. As a Toolset customer you can and should post in the Technical Support forum which we prioritise and where you should receive speedier service.
The same option to conditionally display filters in a custom search form does not exist, I'm afraid.
You can set this up by adding some custom jQuery to your filter controls.
You can use hide() when the page loads to hide the elements you don't want to appear: hidden link
You can check when another field changes using change(): hidden link
You can then show() the elements you want to reveal: hidden link
Here is a crude example which simply hides one filter until another filter has been changed. It doesn't test what it has been changed to, for example, simply that something has been selected.
Because I want to hide both the filter itself and its label, I add a class to the wrapper DIV for the form group so that I can target it with jQuery. In my example I add a class of "show-on-change".
Add the following to the custom JS section of the Filter Editor.
You will need to use your browser tools to inspect the filter form to identify the selector that can be used to target the change event. In my case it is a select dropdown for a custom field filter.