Skip Navigation

[Resolved] Add Select2 to Views Search Dropdown inputs

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

Problem:
How can we have Drop Down Search inputs using Select2 like so in Toolset Views Custom Front End search?

Solution:
Toolset does not implement this in the Custom Searches on the Front end, to have it you would need to suggest it as a feature request at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/.

If you would need an immediate solution you would need to integrate Select2 into the Views Front End Filters, which we cannot support in this forum.

If you'd need help with the custom coding, we recommend consulting with certified contractors from https://toolset.com/contractors/

This support ticket is created 4 years, 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 7 replies, has 3 voices.

Last updated by fernandoS-3 4 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#1581277

I'm trying to get a live searh in dropdown like as the cred dropdown.

I followed the instructions of this post without results. -> https://toolset.com/forums/topic/live-search-dropdown-in-wpv-control-post-taxonomy/

Any help?

Thanks in advanced

#1581895

What precisely do you mean with Live Search?
A Select2?
That would be what Toolset Forms uses in "Parent Post Selectors", for example.

If you want to implement that to Toolset Search Inputs you need custom code that we can not provide here.
You'd need to request it from https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ as a feature to be considered in future. If you need help with custom programming, we can suggest consulting any https://toolset.com/contractors/.

Unfortunately, we cannot help with implementing Select2 on the Views Search Inputs, it would require a new Feature.

#1581959
Captura de pantalla 2020-04-11 a las 10.37.13.png

Hi Beda.

I'd like to get in dropdown custom search the same dropdown that I have in cred form.

I attach an screenshot -> This is a toolset cred form with data-live-search. I followed the instructions of Minesh post but It doesn't work.

Can you help me?

#1582025

Thanks for adding the screenshot. This is a "Select2" Select Input.
Select2 is an external library that developers can use to enhance the Select Inputs.
hidden link

Toolset does not implement this in the Custom Searches on the Front end, to have it you would need to suggest it as a feature request at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/.
If you would need an immediate solution you would need to integrate Select2 into the Views Front End Filters, which we cannot support in this forum.

If you'd need help with the custom coding, we recommend consulting with certified contractors from https://toolset.com/contractors/

#1582109

My issue is resolved now. Thank you!

#1582255

Hi again Beda. It's solved. Thanks to looking at toolset.wiki and doing some tests

function enqueue_select2_jquery() {
    wp_register_style( 'select2css', '/wp-content/themes/my-child-theme/js/select2.min.css', false, '1.0', 'all' );
    wp_register_script( 'select2', '/wp-content/themes/my-child-theme/js/select2.min.js', array( 'jquery' ), '1.0', true );
    wp_enqueue_style( 'select2css' );
    wp_enqueue_script( 'select2' );
}
add_action( 'wp_enqueue_scripts', 'enqueue_select2_jquery' );

In Dropdown filter :

Class: Select
Style: Select2

in Search and Pagination JS

jQuery( document ).ready(function() {
    jQuery('.select').select2();
});
#1582257

It's solved!

#1912389

Hi, David!
It almost worked. Even with values in the combobox, "no results found" is reported. When running Select2, it looks like it is reset.
What could it be?
Thank you!