Skip Navigation

[Resolved] Conditional display of CPF in new post form depending on a selected taxonomy

This support ticket is created 4 years, 4 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.

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 10 replies, has 2 voices.

Last updated by valentinP-3 4 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1683943

Hello, I would like to conditional display custom fields in new post form depending on a selected taxonomy (selected in the same form)
We have categories, and we would like that depending on each category selected at the begining of the post form the have displayed different custom fields
Please advice
Txh

#1684601

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Toolset Form offers the conditional display - have you checked the following doc?
=> https://toolset.com/course-lesson/conditional-display-for-form-inputs

#1684815

Hello Minesh,

Yes, we checked that doc. Also, we use the conditional display on some of our forms. But this is a different situation. Let me explain to you exactly what are we trying to do.
On our website we are trying to set up a real estate section in which users can post their real estate listings. We created a custom post type Real Estate Listings and created the following taxonomies (CPT categories): Residential, Offices, Industrial, Land. We also created specific custom fields that are used by these categories. The thing is that some fields are good only for some categories. For example, we don't want the "Rooms number" custom field to be displayed on a listing that checked the Land category, because it makes no sense. In the content template, we managed to display only the relevant fields for each category using the conditional display. The problem is when creating an Add New Listing form. In this form we want to use a conditional display so that the user can see only the relevant fields depending on the category(taxonomy) he chooses. So we created an Add New Listing form that starts with a field that lets the user choose his category (taxonomy). Depending on his choice, the form must display only the relevant fields. We managed to do such a thing using Custom Fields but we want to do this conditional display not depending on the custom field but depending on the Category (taxonomy) - so we want to display add new post fields depending on TAXONOMY (not post field).
Can you help us with a solution?

Thank you!

#1684997

Minesh
Supporter

Languages: English (English )

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

I understand what is your requirement and I understand that you want to display the custom fields based on the taxonomy selection.

Can you please share problem URL and access details and tell me what fields should be displayed with what category?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1688625

Minesh
Supporter

Languages: English (English )

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

Ok - I understand what you want.

I'm on this page and I do not see that the form "Adauga anunturi imobiliare (ID: 50788)" is used there:
=> hidden link

Can you please share where exactly I can see the form.

Also, I would like to know that the taxonomy "Real Estate Categories" is added and available on the form "Adauga anunturi imobiliare (ID: 50788)" - correct?

#1688683

Hello,

hidden link this is the page where the form is located. The taxonomy "Real Estate Categories" is added and available on the form.

Thx

#1688753

Minesh
Supporter

Languages: English (English )

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

I mean, please check the following list of "Real Estate Category" taxonomy:
=> hidden link

I do not see the list of taxonomy terms for "Real Estate Category" taxonomy is added on the page you shared:
=> hidden link

Do you mean that you do not want to display "Real Estate Category" taxonomy with this page? => hidden link

#1688893

Hi Minesh, we cleaned the form so it will be easy to explain what we want.
We have a Taxonomy called"real-estate-category" which has 5 options. Depending on the option the user choose on the top of the form , then we would like to have displayed only a specific field as seen in the form now on this page hidden link (we give example for 3 taxonomy values in the form)
Please let me know if you understood what we want.
Thanks

#1688955

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

I've adjusted the code within the form as given under:

[cred_show_group if="( $(real-estate-category) eq 'Rezidential (vile, case, apartamente, garsoniere)' )" mode="fade-slide"]
----------------------------------------------------------------------------------
We want the below custom field to be displayed only if the real-estate-category is eq "apartamente-case-vile-garsoniere-de-inchiriat-vanzare"
	<div class="form-group">
      
[cred_field field='tip-imobil-rezidential' force_type='field' class='form-control' output='bootstrap']
		
	</div>
[/cred_show_group]


[cred_show_group if="( $(real-estate-category) eq 'Spatii Comerciale' )" mode="fade-slide"]
----------------------------------------------------------------------------------


We want the below custom field to be displayed only if the real-estate-category is eq "spatii-comerciale-de-vanzare-inchiriat"
	<div class="form-group">
[cred_field field='tip-spatiu-comercial' force_type='field' class='form-control' output='bootstrap']
		
	</div>
[/cred_show_group]


[cred_show_group if="( $(real-estate-category) eq 'Terenuri' )" mode="fade-slide"]
----------------------------------------------------------------------------------
We want the below custom field to be displayed only if the real-estate-category is eq "teren-de-vanzare-de-inchiriat"
	<div class="form-group">
[cred_field field='tip-teren' force_type='field' class='form-control' output='bootstrap']
		
	</div>
[/cred_show_group]

I can see its working as expected. Can you please confirm.

#1689911

Minesh
Supporter

Languages: English (English )

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

Can you pleases confirm now conditional display based on the checkboxes that belongs to your taxonomy works fine now.

#1689923

My issue is resolved now. Thank you!