Tell us what you are trying to do?
I need to disable possibility to select parent taxonomy:
hidden link
in select2 field called Wybierz miasto.
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?
Hello,
I assume we are talking about the shortcode:
[cred_field field='fotograf-slubny' display='select' output='bootstrap']
There isn't such a built-in feature within Toolset form plugin, see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
No such an option can achieve what you want:
disable possibility to select parent taxonomy
So it requires custom codes, since you are using select JS framework, I suggest you try to follow their document to disable those options:
hidden link
For your reference
Sory, but i dont have JS or JQuery skills, I think i understand this code. But i dont know how to revert it for my purpose
We don't provide such kind of custom codes support:
https://toolset.com/toolset-support-policy/
However, I can setup a demo for you, for example, you want to disable term "Kujawsko-pomorskie" ID 164 and term "Dolnośląskie" ID 160, you can modify the JS codes as below:
jQuery(document).ready(function() {
jQuery("select[name='fotograf-slubny[]'] option[value=160]").attr('disabled', 'disabled');
jQuery("select[name='fotograf-slubny[]'] option[value=164]").attr('disabled', 'disabled');
...
I have tested it in your website, it works fine, see the result page:
hidden link
More help:
hidden link
Thanks again Luo,
The code you gave morks great, i went 1 step further:
and took different value - as i see parent taxonomy have data-parent static and set to -1 so i dont need to create 10 or 15 queries. I have chanched code to this:
jQuery("select[name='fotograf-slubny[]'] option[data-parent=-1]").attr('disabled', 'disabled');
Maybe this will help someone with my problems and my lack of knowledge of coding