-
-
Notifications
You must be signed in to change notification settings - Fork 407
Multiple fields support #799
Copy link
Copy link
Open
Labels
enhancementNew feature, or existing feature improvementNew feature, or existing feature improvementquestionQuestion about WTForms behaviorQuestion about WTForms behavior
Milestone
Metadata
Metadata
Assignees
Labels
enhancementNew feature, or existing feature improvementNew feature, or existing feature improvementquestionQuestion about WTForms behaviorQuestion about WTForms behavior
Type
Fields
Give feedbackNo fields configured for issues without a type.
I could not find it clearly written on the specs, but HTML allows an input file to have several values. For instance this is valid HTML:
However, wtforms does not support this, and always consider the first item of the request for a given name (here
bar).wtforms/src/wtforms/fields/core.py
Lines 362 to 363 in 9f9146c
wtforms provides an alternative to manage several times the same input, with FieldList. However FieldList have some differences:
append_entryandpop_entry, users cannot directly delete a field in the middle of the listI think wtforms could support multiple fields. For instance we could add a
multiplefield inFieldswith a default value atFalse, matching the current behavior. If set toTruefield.datawould return a list instead of a single value. Validators should validate each individual values.This could help with the validators handle one single value part of #662