EasyCorp / EasyCorp/EasyAdminBundle

File input is not initialized for newly added items into collection

Open
#6,637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug status: confirmed
Dominant language
PHP
Stars
4.3k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
11

Description

Describe the bug
File input javascript handler initialized in assets/js/field-file-upload.js is only done on page load. When having FileUploadType in collection the initializer is not called when adding new item into the collection.

To Reproduce
Version: latest (v4.20.2)

Have a collection with FileUploadType in your form
Add new item
Select a file to upload
You should be able to see filename and its size, but instead it looks like you did not select a file.

Additional context
Need to modify field-file-upload.js

document.addEventListener('ea.collection.item-added', function(){
setTimeout(function () {
eaFileUploadHandler
}
}, 1000);
} );

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with assets/js/field-file-upload.js and inspect how the file-upload handler is initialized on page load. Check the ea.collection.item-added event flow, then verify that selecting a file in a newly added collection item displays its filename and size as it does for existing items.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.