I have a csv file and I need to read it as list and add every item to input form, but when I use specific option value
I can add them by pressing comma, but when I read them from .csv file this method does not work. What can be the problem?
with open('templates/Testing.csv') as f:
reader = csv.reader(f)
myvalues = next(reader)
@app.route('/', methods=['GET'])
def page_show():
return render_template('includes/default.html', myvalues=myvalues)
from .csv method(it does not work by pressing comma)
<form action="/action" method="POST">
<input list="myvalues" multiple>
<datalist id="myvalues">
{% for val in myvalues %}
<option value="{{val}}">{{val}}</option>
{% endfor %}
</datalist>
<input type="submit">
</form>
adding specific value method(it works by pressing comma)
<form action="/action" method="POST">
<input list="myvalues" multiple>
<datalist id="myvalues">
<option value="one">one</option>
<option value="two">one</option>
<option value="three">one</option>
<option value="four">one</option>
</datalist>
<input type="submit">
</form>