0

My Flask web application form has a drop-down box with the list of all countries in the world. However, it gets tedious for the user to scroll and find the appropriate country they're looking for. Therefore, I'm trying to apply 'data-live-search' in my select fields for easier user navigation.

However, I'm trying to figure out the place I'm going wrong as my 'data-live-search=true' in select field does not yield any search box.

My codes are as:

routes.py (Flask Form)

def country_list():
    return [('Angola','Angola'),('Andorra','Andorra').....] #All the countries


class Main_Form(FlaskForm):
    countryList = SelectField("Enter the Country:", validators=[DataRequired()], choices=country_list(), render_kw={"data-live-search":"true"})

mainform.html

<div class = "container">
    <fieldset>
        <form class="form-group row" action="" method="post" novalidate>
            <div class = "form-group col-md-12">

                {{ wtf.form_field(form.countryList, class='form-control') }}

            </div>
        </form>
   </fieldset>
</div>

When I look at the page source the data-live-search='true' appears for the select field but the drop-down does not contain any Search Box

  • 1
    Does this answer your question? [Why does data-live-search not work in a simple example](https://stackoverflow.com/questions/48681464/why-does-data-live-search-not-work-in-a-simple-example) – pjcunningham Jun 20 '22 at 20:59
  • It gives me an idea but there are some restrictions in my organization due to which I can't use this currently. – user3709312 Jul 05 '22 at 14:01

0 Answers0