Skip Navigation

[Resolved] Multi select with filter for taxonomy field on cred form

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

Problem:
Multi-select with filter for taxonomy field on cred form, how to convert taxonomy select to select2

Solution:
Please add following code to your form's JS box to convert taxonomy select to select2.

jQuery(document).ready(function($){
  
 id = jQuery("select[name='skill[]']").attr('id');
   jQuery("#"+id).toolset_select2();   
    
});

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/multi-select-with-filter-for-taxonomy-field-on-cred-form/#post-1114951

Relevant Documentation:

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

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

Last updated by mattL-11 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1114344
Screen Shot 2018-09-24 at 13.41.09.png

Tell us what you are trying to do?
I'm trying to adjust the default presentation of the taxonomy multi select field when adding or editing an existing post using a cred form.

I have this working fine for taxonomy multi-select fields on a search view using select2.js plugin:

$(document).ready(function() {
$('.js-example-basic-single').select2();
});

and adding class="js-example-basic-single" to the input field, like this:

[wpv-control-post-taxonomy taxonomy="skill" type="multi-select" url_param="wpv-skill" class="js-example-basic-single"]

I've attached screenshot so you can see how it looks on a search filter view.

But on cred form it doesn't change the appearance, I just see the same multi-select list, which isn't too user friendly having to cmd + click to choose multiple option.

It would be really useful to have this on the add/edit forms so everything works the same for user searches, and editors. Is it possible?

#1114951

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - could you please try the following code and add it to your form's JS section and try to resolve your issue.

jQuery(document).ready(function($){
 
 id = jQuery("select[name='skill[]']").attr('id');
   jQuery("#"+id).toolset_select2();   
   
});

Where:
- Please replace taxonomy select field name if required.

#1115587

My issue is resolved now. Thank you!