Opened 18 months ago

Last modified 6 months ago

#34488 closed Cleanup/optimization

ClearableFileInput widget forgets "Clear" selection when form is not valid — at Version 1

Reported by: bmihelac Owned by: nobody
Component: Forms Version: 4.1
Severity: Normal Keywords: admin, forms, ClearableFileInput
Cc: Marcelo Galigniana Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by bmihelac)

ClearableFileInput widget forgets "Clear" selection when form is not valid, that causes file would not be deleted once when form is valid again. This can be inconvinient, especially for forms with many fields.

To reproduce:

  1. Choose admin for any model instance where attachment is not required and has some validation,
  2. check "Clear" next to the attachment, and change the form, so validation would fail,
  3. Save form, validation error would occur, attachment and "Clear" would be empty
  4. make form valid again and Save, attachment woult not be cleared

(I am attaching example screenshots)

https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-before.png

https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-validation-error.png

https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-validation-success.png

Change History (1)

comment:1 by bmihelac, 18 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top