Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#7576 closed (duplicate)

Fieldsets marked as collapsed should not be collapsed on errors

Reported by: Jonas Owned by: nobody
Component: Contrib apps Version: newforms-admin
Severity: Keywords: nfa
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Current behaviour:

Using newforms-admin, I edit a model field that's contained in a collapsible fieldset. If this field does not validate, for instance I input a character string in an IntegerField, the page gets redisplayed after submitting and an error gets shown next to the field. On the redisplayed edit page, the fieldset containing the error is collapsed again.

Expected behaviour:

When a fieldset contains an error, it should not be collapsed so the error can be found easily. In fact, the comments in django/contrib/admin/media/js/admin/CollapsedFieldsets.js:22 say so: "Collapsing shouldn't apply in the case of error messages."

Fix:

The bug is in djang/contrib/admin/media/js/CollapsedFieldsets.js in the function named "fieldset_has_errors". A loop checks for the CSS class "error", but the DIV displaying the error is currently marked with a class called "errors".

I've attached a patch that fixes this. Thank you for considering it.

Attachments (1)

fieldset_has_errors.patch (632 bytes) - added by Jonas 7 years ago.
Patch to fix display of collapsed fieldset on errors

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Jonas

Patch to fix display of collapsed fieldset on errors

comment:1 Changed 7 years ago by brosner

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #5873. Will apply this patch shortly. Excellent work Jonas!

comment:2 Changed 3 years ago by jacob

  • milestone 1.0 alpha deleted

Milestone 1.0 alpha deleted

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