How to get if checkbox is checked on flask

前端 未结 2 1555
情深已故
情深已故 2020-12-09 05:54

I\'m using Bootstrap with Flask Python.

 request.form.get(\"name\")
 #name is the name of the form element(checkbox)

 
2条回答
  •  北海茫月
    2020-12-09 06:28

    you can try the following:

    HTML:
    
    

    In flask:

     value = request.form.getlist('check') 
    

    This will give you the value of the the checkbox. Here value will be a list.

    value = [u'edit']
    

    You can also get value of multiple checkboxes with same name attribute.

提交回复
热议问题