Forums Forums Search & Filter Pro Is it possible to have combo box with check box for a SELECT search field?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #23219

    Hi,

    I am curious to know if we already have the feature of combo box(dropdown) with check box for a search field?
    something like
    https://imgur.com/m2TqmfM

    Thanks

    Anonymous
    #23394

    DONE!!!
    // used some java script jquery.min.js and jquery.multiple.select.js and multiple-select.css
    <link rel=”stylesheet” href=”/wordpress/wp-content/themes/sydney/login/multiple-select.css” />
    //After $returnvar .= “</select>”;
    //Add
    $returnvar .= ‘<script src=”/wordpress/wp-content/themes/sydney/js/jquery.min.js”></script>
    <script src=”/wordpress/wp-content/themes/sydney/js/jquery.multiple.select.js”></script>
    <script>

    $(function() {
    $(“#’.str_replace(‘/’, ”, $name).'”).change(function() {
    console.log($(this).val());
    }).multipleSelect({
    width: “100%”
    });
    });
    </script>’;

    Ross Moderator
    #23491

    Nice ๐Ÿ™‚ thanks for the update.

    Anonymous
    #23544

    For Full code..its here..
    Add this new function in class-search-filter-generate-input.php file

    public function generate_multiselectcheckbox($dropdata, $name, $defaults, $elem_attr = "",$id="",$all_items_label=null)
    
        {
            $returnvar = "";
    
    //        if($additionalFeature==false){
    //            $returnvar .= '<div style="display:none;" id="div_' . str_replace('/', '', $name) . '">';
    //        }
    //        else{
    //            $returnvar .= '<div style="" id="div_' . str_replace('/', '', $name) . '">';
    //        }
    
            $returnvar .= '<select multiple="multiple" class="postform" name="'.$name.'[]"'.$elem_attr.'id="'.str_replace('/', "", $name).'" slug="'.$all_items_label.'">';
            if(isset($all_items_label))
            {
    
                if($all_items_label=="")
                {//check to see if all items has been registered in field then use this label
                    $returnvar .= '<option selected="selected" class="level-0" value="'.$name.'">'.esc_html($all_items_label).'</option>';
                }
            }
            foreach($dropdata as $dropdown)
            {
                $selected = "";
    
                if(isset($defaults))
                {
                    if(is_array($defaults)) //there should never be more than 1 default in a select, if there are then don't set any, user is obviously searching multiple values, in the case of a select this must be "all"
                    {
                        foreach($defaults as $defaultid)
                        {
                            if($defaultid==$dropdown->term_id)
                            {
                                $selected = ' selected="selected"';
                            }
                        }
                    }
                }
                $returnvar .= '<option class="level-0" value="'.esc_attr($dropdown->term_id).'"'.$selected.'>'.esc_html($dropdown->cat_name).'</option>';
            }
            $returnvar .= "</select>";
    
            $returnvar .= '<script src="/wordpress/wp-content/themes/sydney/js/jquery.min.js"></script>
                           <script src="/wordpress/wp-content/themes/sydney/js/jquery.multiple.select.js"></script>
                            <script>
                            $(function() {
                                $("#'.str_replace('/', "", $name).'").change(function() {
                                console.log($(this).val());
                                }).multipleSelect({
                                width: "100%"
                                });
                            });
                            </script>';
    
            return $returnvar;
        }

    choose from the UI which choice_type u want. for example. I choose multi select so Call this function into
    if ($values['choice_input_type'] == "multiselect") by referring

    $returnvar .= $this->create_input->generate_multiselectcheckbox($countrychildren, $field_name, $defaults, $elem_attr, str_replace('/', '', $field_name), false);

    Don’t forget to add the above javascript files and css file.

    Keep calm and enjoy coding.. ๐Ÿ˜‰
    Cheerssss

    Ross Moderator
    #23580

    Many thanks, will consider integrating this as a feature ๐Ÿ™‚

    Anonymous
    #49750

    Im trying to implement function with no success – this is exactly what im looking for.
    Can somebody assist?

    Trevor
    #49753

    At this time, this is still not possible.

Viewing 7 posts - 1 through 7 (of 7 total)