In a CRED form, I need to display a specific taxonomy based on another previously chosen taxonomy. I can arrive at this end by using two paths, which I do not know how to follow from the Toolset syntax point of view.
1. In a CRED form dropdown taxonomy selection, is it possible to display only specific terms (handpicked by their IDs)?
2. In a CRED form dropdown taxonomy selection, is it possible to display ONLY the taxonomies that have, say, a custom term field with the value 'X'?
My global problem is the following: I have a list of districts (taxonomy: district) and a list of cities (taxonomy: city).
What I want to achieve: when I select a district from a dropdown, the next dropdown should be populated only by the cities within that district. My possible theoretical solutions are:
1. By using conditional display, depending on the selected district, the cities dropdown will be populated with handpicked cities (by IDs or by names).
2. By using conditional display, depending on the selected district (say B), only cities having the precise custom term field BB (defined manually for each city) to be displayed in the next dropdown.
Personally, I prefer to go with number 2, since in time, more cities will be added, and I do not want to go each time to change the CRED form.
Here is what I have achieved until now:
<div class="form-group">
<label>District</label>
[cred_field field='district' force_type='taxonomy' single_select='true' display='select' output='bootstrap' class='form-control']
</div>
[cred_show_group if="($(district) eq '12')" mode="fade-slide"]
<div class="form-group">
<label>City</label>
[cred_field field='city' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
</div>
[/cred_show_group]
In the second div, how can I tell Toolset to show in the dropdown ONLY some cities? In this moment, it shows them all. A stupid solution would be to define, for each district, a separate taxonomy for its cities, say district1_cities, district2_cities and so on, but I guess this is not the optimal way to go.
Any help would be appreciated. My theoretical solutions are different from what other Toolset users were offered within this forum, and I strongly believe that there is a way to implement them.