Skip Navigation

[Resolved] Possible to have a "searchable select field"?

This support ticket is created 3 years, 8 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 3 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2060761

Tell us what you are trying to do? On the search form on this page: hidden link - we have a select field. Now we like to build it out and like, that customers can start search in addition to only select.

Is there any documentation that you are following? I not found anything

Is there a similar example that we can see? What I did once, but not sure if I can use the similar code:

add_filter( 'wpt_field_options', 'fill_select', 10, 3);
function fill_select( $options, $title, $type ) {
    if ($title == 'my-custom-select')  {
        $options = array();
        $args = array('hide_empty' => 'false');
        $terms = get_posts( array('cycling-tour'), $args );
         
        foreach ($terms as $term) {
            $options[] = array(
                '#value' => $term->post_id,
                '#title' => $term->post_name
            );
        }
    }
}

In the search form itself, I might have then a normal textfield.

What is the link to your site?

#2061161

Hi,

Thank you for contacting us and I'd be happy to assist.

I've performed some tests and can confirm that there is no built-in option available in the view's search to convert a regular select field into an 'autocomplete' or 'search as you type' kind of field.

To achieve something like this you'll need to include some custom script through a third-party library like 'select2':
hidden link

For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar