Reputation: 33
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
Upvotes: 0
Views: 298