I want to retrieve in my python app the selected value in a html/javascript form.
Here is my html code :
{% block content %}
<form method="post">
<div class="form-group">
<label for="title">Numéro</label>
<input type="number" name="NUMERO"
placeholder="666, etc" class="form-control" required
value="{{ request.form['NUMERO'] }}"/>
</div>
<div class="form-group">
<label for="TYPE_VOIE">Type voie</label>
<select class="form-control" id="TYPE_VOIE" required >
<option>Rue</option>
<option>Impasse</option>
<option>Place</option>
<option>Boulevard</option>
<option>Avenue</option>
</select> value="{{ request.form['TYPE_VOIE'] }}"
</div>
Here is python code:
if request.method == 'POST':
numero=int(request.form['NUMERO'])
type_voie= request.form['TYPE_VOIE']
and now the error message:
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'TYPE_VOIE' ...
In fact, I don't know where to put value="{{ request.form['TYPE_VOIE'] }}"
Can you help me ? Thanks in advance