How to get multiple selected items from Form in Flask

后端 未结 1 503
没有蜡笔的小新
没有蜡笔的小新 2021-01-13 03:49

With the

having two list items selected \"Category 01\" and \"Category 03\":

 
    
1条回答
  •  死守一世寂寞
    2021-01-13 04:13

    You will want to use the getlist() function to get a list of values.

    First, change your form as below:

     
        

    And in your flask function:

    if request.method == 'POST':
        as_dict = request.form.getlist('myform')
        print request
    

    Hope this helps!

    0 讨论(0)
提交回复
热议问题