Skip to content

Conversation

@dartblack
Copy link

File input is not initialized for newly added items into collection

File input is not initialized for newly added items into collection
@javiereguiluz
Copy link
Collaborator

I can confirm the reported bug ... but the proposed solution doesn't work for me either 😐

Also, the code had some issues like eaFileUploadHandler that should be eaFileUploadHandler().

Did this change solved the bug for you? Thanks!

@dartblack
Copy link
Author

I can confirm the reported bug ... but the proposed solution doesn't work for me either 😐

Also, the code had some issues like eaFileUploadHandler that should be eaFileUploadHandler().

Did this change solved the bug for you? Thanks!

This code fragment in the project helps me for solving this bug

document.addEventListener('ea.collection.item-added', function () {
setTimeout(function () {
const fileInputs = document.querySelectorAll("input[type=file]");
for (let i = 0; i < fileInputs.length; i++) {
fileInputs[i].addEventListener("change", function () {
const label = document.querySelector("label[for=" + fileInputs[i].id + "]");
label.innerHTML = fileInputs[i].files[0].name;
});
}
}, 1000);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants