mbraak/django-file-form

uploadComplete sends wrong element with multiple file forms on a page.

BoPeng opened this issue · 5 comments

When there are multiple file form on a single page, the following scenario will cause uploadComplete to be triggered with a wrong element.

  1. Upload a file in the first form. This will result in the creation of a uploaded file with classes .dff-file .dff-file-id-0
  2. Upload a file in the second form. This will create another uploaded file with the same class.
  3. When uploadComplete event is triggered, the following line

const element = document.getElementsByClassName(
`dff-file-id-${upload.uploadIndex}`

causes the item from the first uploaded file to be sent. For my application, this causes the customized widget to be added to the wrong uploaded file.

I'll have a look.

This is the pr with the fix: #668.

Thanks! I can confirm that the PR works.

Pr 668 is merged. I plan to release a new version of django-file-form this week.

Version 3.5.2 is released. It includes this fix.