EasyCorp / EasyCorp/EasyAdminBundle
File input is not initialized for newly added items into collection
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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