Skip Navigation

[Resolved] Force user to select child term in a taxonomy selector of Toolset Forms

This thread is resolved. Here is a description of the problem and solution.

Problem: In a Taxonomy select field of Toolset forms, there are parent and child terms listed since my Taxonomy is hierarchical. I want it so that the user can, if the user selects any term, only select its most child term. Meaning, the user should never be able to select a parent term, but only eventual child terms of this parent (or other child terms)

Solution: This is not possible without custom code, you can see a short suggestion about how to proceed here https://toolset.com/forums/topic/force-user-to-select-the-latest-lever-of-child-taxonomy-in-cred-form/#post-1452767, it will require customization that Toolset doesn't offer by itself.

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.

Our next available supporter will start replying to tickets in about 2.66 hours from now. Thank you for your understanding.

This topic contains 2 replies, has 2 voices.

Last updated by jean-francoisB 1 year, 9 months ago.

Assigned support staff: Beda.

Author
Posts
#1451519
Capture d’écran, le 2020-01-10 à 12.23.26.png
Capture d’écran, le 2020-01-10 à 12.23.43.png

Tell us what you are trying to do?

On my listing website, user have to create 1 listing and choose a category (taxonomy) for their listing. But I want them to choose the latest child level. I don't want them to be able to select the main first level of taxonomy.

Is there a similar example that we can see?

This page has the exact function that I want : hidden link

The user is forced to go throught the different level of child taxonomy and can only continue when they have reached the last level. So I want to reproduce the same idea in my form. Is their an easy way to make this or I should get a Toolset Contractors to create this function?

What is the link to your site?

We can't see the form in public mode. You need to be a registered user to access the listing form. But it's on hidden link

You can see attached what I have and what I want. Thank you for your help!!

#1452767

That's not possible, just as in WordPress (if you do not use Toolset) you cannot select only child items in the native Categories or other choices, but you always will be presented with all available choices.

Unfortunately, it involves custom code that we cannot provide here in the forum, you'd need to alter those select inputs so that it shows (for example) only the child most items.

You could maybe work around that using a View and populating a Generic Field.
In a View, you can control much better what to display and a generic Field can accept a View as input - but, that won't be a Taxonomy form input.
A generic Field won't save data unless you save it with Custom Code (you can use cred_save_data) to save the set data to the database.

If you are familiar with PHP you could try that path, or, a JS solution on the input itself could also work, but it's not within what Toolset offers.

I suggest you submit this as a request here:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
This will help our Product Management deciding what's next in Toolset forms.

#1458197

Ok thank you. I found someone who will develop the code for me. Have a great day!