Opened 11 years ago

Closed 10 years ago

#4405 closed (invalid)

MultiValueField does not allow sub-fields to be blank

Reported by: adurdin@… Owned by: Konrad Beiske
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If even one of a MultiValueField's sub-fields is blank, a ValidationError is raised, even if that sub-field had required=False

In django/newforms/, line 530

            if self.required and field_value in EMPTY_VALUES:
                raise ValidationError(gettext(u'This field is required.'))

Line 530 should be changed to check the sub-field's required attribute:

            if field.required and field_value in EMPTY_VALUES:

Change History (5)

comment:1 Changed 11 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:2 Changed 10 years ago by Konrad Beiske <konrad@…>

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 Changed 10 years ago by Konrad Beiske

Owner: changed from anonymous to Konrad Beiske
Status: assignednew

comment:4 Changed 10 years ago by Konrad Beiske

Status: newassigned

comment:5 Changed 10 years ago by Konrad Beiske

Resolution: invalid
Status: assignedclosed

MultiValueField is currently made to completely ignore the required field setting of it's subfields. In fact it's init method sets all subfields as not required. It does allow subfields to be blank it self is allowed to be blank as well. Subclasses can allow some fields blank and some not in the compress function.

Note: See TracTickets for help on using tickets.
Back to Top