Issue
This is my code:
@user_bp.route('/band', methods=['GET', 'POST'])
def band_details():
from include.form.User import Banddetails
form = Banddetails()
if request.method == 'POST' and form.validate_on_submit():
pippo = request.args.getlist('name[]')
print 'sei passato di qui' + str(len(pippo))
for item in pippo:
print item
return "result"
return render_template("banddetails.html", form=form, session=session)
I have a similar form:
<input type="text" name="name[]" id="name" value="">
I want get the element name[]
, lastname[]
, ... but I don't understand the procedure described in the flask api.
Solution
If you are using an HTTP POST method you need to retrieve parameters like this:
pippo = request.form.getlist('name[]')
If you use HTTP GET method, do it like this:
pippo = request.args.getlist('name[]')
Check the docs here.
Answered By - kartheek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.