Opened 9 years ago

Closed 9 years ago

#5173 closed (worksforme)

Formsets - Empty form fields display validation errors

Reported by: Simon Litchfield <simon@…> Owned by: adrian
Component: Forms Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:


The formsets tests seem fine. However, when you actually display the fields, it causes them to bind, clean, and throw validation errors even though the forms are empty.

Forms who are part of a formset, should know to check is_empty (or similar) before binding and cleaning their fields.

Attachments (1)

formsets-empty-forms-5897.diff (1.2 KB) - added by Simon Litchfield <simon@…> 9 years ago.
Quick hack to fix the problem, against rev 5897

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Simon Litchfield <simon@…>

Quick hack to fix the problem, against rev 5897

comment:1 Changed 9 years ago by Simon Litchfield <simon@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests set
  • Owner changed from adrian to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Design decision needed

Also fixes which on surface seems to be a small typo in _get_change_forms().

comment:2 Changed 9 years ago by anonymous

  • Owner changed from anonymous to adrian
  • Status changed from assigned to new

comment:3 Changed 9 years ago by jkocherhans

  • Resolution set to worksforme
  • Status changed from new to closed

Can you give some more details on what you are doing here? The empty add forms are reset when you call full_clean on the FormSet. I'm not able to reproduce this. The code from the view that produces this problem would probably be sufficient. Your solution may be better, but I haven't though it through yet. Either way seems really hackish. I'm closing this for now, but please reopen it if you post an example that triggers this.

Here's a link to the reset code:

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