Problem:
The issue here is that the user wanted to integrate the select2 dropdowns for their Toolset forms Generic fields.
Solution:
This can be done by importing the select2 javascript and css library.
Add the following to your custom code snippets at Toolset->Settings-> Custom Code and activate it.
wp_enqueue_script('select2_js', '//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js', array(), null, true); wp_enqueue_style( 'select2_css', '//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css' );
From there you will need to add the following JS to your Form's JS section to enable the select2 for your field.
jQuery(document).ready(function() { jQuery('.class-goes-here').select2(); });
Now you will need to replace 'class-goes-here' with the ID/Class of the custom field that is generated on the frontend.
For further information on the usage of Select2 I recommend looking at the documentation below.
https://select2.org/getting-started/basic-usage
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 |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 3 years, 2 months ago.
Assisted by: Shane.