I have the following code to display information in a shopping-cart manner:
<form method="POST" action="/updateorder/{{item.idordre}}">
{%for parts in viewParts %}
<div class="invisible">
<input class="form-control" id="idpart" name="idpart" value="{{parts.idpart}}"></div>
<td><div class="form-group col-md-3">
<input class="form-control" id="quantity" name="quantity" required type="number" value="{{parts.quantity}}">
</div></td>
{%endfor%}
<div class="container">
<input class="btn btn-warning btn-md" id="submit" name="submit" type="submit"value="Update quantity">
</div>
</form>
There might be several instances of the same formfields with idpart and quantity where the user can change the quantity and submit the update.
@app.route('/updateorder/<int:ident>',methods=['GET','POST'])
def updateorder(ident):
form = updateOrder()
if request.method =="POST":
quantityChange = request.form.to_dict()
dostuff()
When i receive the form in my route i only get the first form value. Is it possible to receive data like this at all?