Issue
In regular HTML, you can have multiple fields POST to an array:
<input type="text" name="arr[]">
<input type="text" name="arr[]">
<input type="text" name="arr[]">
<input type="text" name="arr[]">
How can I get this functionality from WTForms? Basically, I have a form where users and click on little plus and minus buttons to add or remove fields from the form.
Solution
You're looking for WTForm FieldList. It allows you to create an arbitrary list of the same field.
Ex.
emails = FieldList(StringField('email'), min_entries=1, max_entries=5)
Answered By - junnytony
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.