[Resolved] CRED Form and view – Country and Region – Taxonomy or Custom Field
This support ticket is created 4 years, 8 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have a problem with setting up an optimal country and region for users using CRED Form and Search View.
I need users to create a band with a specific country and a specific region in the country with a CRED Form. I also need to use this country and region in a search view. In both case, I need the region to appear conditionnally depending on the value of the "Country". The most logic solution would have to set a taxonomy for country and a taxonomy for region.
----------------------
Example 1 : Using Country as Custom Field :
1./ The CRED FORM :
First, a user needs to create a band using a Toolset Form. To create the band, the user needs to select a country and then a Region within the country. I manage to make this happen perfectly by using a conditional output in my cred form. In this case Country is a Custom field and region is a taxonomy.
2./ The Search View :
Second I create my search view. But here I have two problems. I don't manage to have the region appears conditionnally depending on the selection of the Country . Furthermore, the country field is always directly filled with the first choice in the search field "Country" ( Pays du groupe ou de l'artiste in the following url : hidden link)
--------------------
Example 2 : Using Country as Taxonomy :
1./ The CRED FORM : I can't select taxonomy as a conditionnal output. It means that the region taxonomy field in the Cred form cannot appear conditionnaly right ?
2./ The Search View :
The country field appears perfectly and the user can filter with the country but here again, I don't find any way to make the region appear conditionnally.
-------------------------
Basically, I am just looking for a way to have the region (taxonomy) appearing conditionnally depending on the Country field (or taxonomy value) in the cred form for post submission AND appearing conditionnaly in the search view.
Is there any way to achieve this goal.
I have been searching for a solution for 2 month at least and my client really wants this functionnality.
If I Understand correctly you have a number of fields for Region and you only want the specific field for that region to show up when the User selects a Country where that region belongs correct?
If so then this won't be possible by default with Toolset. You will need to use Javascript to Hide and display the filters based on the item that was selected in the search.
In CRED this can be done using the conditionals but because of how view works it would require some Javascript code to do this.
First you will need to get what value the user selects in the Country dropdown and then display the region search field based on what .
1./ The CRED FORM :
So If I understand well, I can display the conditionnally the taxonomy "Region" based on the value of the taxonomy "Country" in the Cred Submission Form right ?
I would please need a little bit of help here because I can easily create Conditionnal groups based on Custom field values but I cannot find the way to create conditionnal groups based on Taxonomy (please see picture attached).
How can I achieve that please ?
With a custom post field "country" I use this code and it works perfectly.
But I cannot find the way to use the taxonomy "country" instead.
It would be much more convenient for me to use a taxonomy.
<div class="form-group">
<label>Pays du Groupe ou de l'artiste</label>
[cred_field field='pays-artiste' force_type='field' class='form-control' output='bootstrap' select_text='Ecrivez le nom de votre Pays ... ']
</div>
[cred_show_group if="( $(pays-artiste) eq 'france' )" mode="fade-slide"]
<div class="form-group">
<label>Département</label>
[cred_field field='region' force_type='taxonomy' output='bootstrap' display='select' single_select='true' select_text='Ecrivez le nom de votre Département ...']
</div>[/cred_show_group]
2./ The Search View :
In the search view, I will need to add some custom javascript code in order to display the Region conditionnally right ?
Thank you for the link 🙂