Tell us what you are trying to do?
I want users to be able to select up to 2 categories for a custom post type when using a toolset form on the front end. I have the form set for a single select, but would like to offer more choices.
Is there any documentation that you are following?
i have looked here - https://toolset.com/forums/topic/limit-number-of-checkboxes-allowed/ but that is for checkboxes. can it also be applied to a select drop down?
Is there a similar example that we can see?
What is the link to your site?
hidden link
Hello,
1) You can turn the single select of taxonomy field in Toolset form into multple select with option:
Display taxonomy as a select dropdown with multiple selection
see the screenshot: multple-select.JPG
If you are using "Expert mode", you can setup the taxonomy field shortcode, like this:
[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select']
Please replace "category" with your custom taxonomy slug
2) Then use below JS codes to setup the limitations:
jQuery(document).on('cred_form_ready', function(){
var tema_limit = 2;
jQuery('[name="category[]"]').on('click', 'option', function() {
if(jQuery('[name="category[]"] option:selected').length > tema_limit) {
jQuery(this).removeAttr("selected");
}
});
});
Same as above, please replace "category" with your custom taxonomy slug, tand test again