I'm using flask and I want to get the output of a check box.
<input type="checkbox" name="match" value="matchwithpairs" checked> Auto Match <br>
In my code I have a condition if the check box is checked do the following if not do something else. The condition I'm using is as follows:
if request.form.getlist('match')[0]=="matchwithpairs":
DO SOMETHING
else:
DO ANOTHER THING
I've read a similar post and tried to use the output of request.form.getlist('match') and since its a list I use [0] to the value from the first index, but it seems I'm doing something wrong. Is this the correct way to get the output or is there a easier/better way?
Aucun commentaire:
Enregistrer un commentaire