Tell us what you are trying to do?
I have CPT States, CPT Regions and CPT Specialists - all together connected with proper relationships.
I decided to make the States/regions as CPT because I was learning with the Real estate Toolset training page and there is a similar setup, I also use State/regions dropdowns in my custom search and though I can use these dropdowns on post form as well.
But I can't as the two dropdowns are not dependent on each other, so when the user selects a state, the second dropdown shows all regions instead of the ones related to the before selected state.
I discussed possible solutions on Toolset Facebook group, but with nearly no success. I read multiple support threads, but it either won't fit my setup or the solution/workaround was too advanced for me.
Many people suggested making the states and regions taxonomies again, but it won't solve my issue and I am not sure if I could make a similar custom search with taxonomies.
The last solution (not my favorite) would be to connect Specialists and States/regions manually, is that how its supposed to work on your real estate training site?
Is there any documentation that you are following?
Unfortunately at the moment there is no way to create a dependent field in our plugins. You will essentially need to connect the items manually.
Secondly the next best solution is that you create conditional fields. Example if you have a single field called State which is a select field, the next thing you will have is cities. However you will need to create a separate dropdown for each state's city and add field conditionals.
This way only the city that are in the selected states will show up.
You will need to set your filters to disappear based on the initial options that the user chooses. So if the choose California, only the options for California will appear.
I 've read this documentation a hundred times...
How do I set the filters to disappear? By "Show only available options for each input"?
I tried numerous times all possible settings again, I did not find a solution and I messed up even worse 🙁
Do you have any working example with dependent parametric search?
All I need is to somehow achieve the States/Cities dropdowns you have at hidden link but not using relationships (as I have one relationship filter in the custom search already)
From what I see the filters are already dependent on each other. If you select an option from "Stát" then the filter "Město-čr" will only display the options relevant to the Stat filter.
What I did was to add a default value so when no option is selected the filter resets.
Sorry, I guess I made a mistake somewhere else before...
it does display only the options relevant to the Stat filter because the "mesto-cr" is a select custom field which is appearing only when in Stat select custom field is selected the state relevant to "mesto-cr" / conditonal display ( Stát = 1) in the back-end.
And I did the same with another state (sr) so I have "mesto-sr" to show only if (Stát = 2)
Because the mesto-cr is always there it does not disappear = when someone pick the other state (sr), the mesto-cr will be still there, but without options... I would need the mesto-sr dropdown to appear instead.
In the back-end I pick state, when I pick state (cr) the "mesto-cr" will appear. When I pick "sr", the mesto-sr will appear.
Given that this is a frontend filter then the filter itself won't dissappear, only the values itself will disappear in that filter.
In order to make the entire filter disappear you will need to use some custom code to check if the select field has any select options and then hide it if it doesn't.
That would be totally fine that only values appear/disappear in the front-end filter, but I need the values to change based on the selection of the first filter.
So:
In the front-end filter, I pick a state, when I pick state "cr" the values of "mesto-cr" will appear. When I pick "sr", the values for mesto-sr will appear in the second filter.
Ok so you are adding multiple mesto filters on the search correct?
What you can do is to write some jQuery to see which value is selected on the first filter. If it is "cr" then your jQuery will unhide the mesto-cr filter and vice versa.
You should be able to use the .change method on this one. hidden link
Yes, basically I just need the user to be able to pick a state and after the selection, I need him to be able to pick a region (or city..) related to the state selection. While I cannot use a relationship filter.
Ok, got it, but if this is the only solution I have no experience with jQuery and I got no more time to even consider to try to learn the basics now.
So I need to hire someone to write the jQuery.
So the last question would be if the person needs to know Toolset? I guess that there is no need to know Toolset , but just making sure.
"So the last question would be if the person needs to know Toolset? I guess that there is no need to know Toolset , but just making sure."
No the developer doesn't need to know toolset because the jQuery would be a standard script that is just picking up what value is selected and displaying a hidden field.
It should be noted that we have a few developers registered with us to help out with projects like these that need custom coding. https://toolset.com/contractors/