New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileEdit not removing file names after reset() #1597
Comments
Hello, I have the same problem, I don't know how to delete the file name, since with Reset() it doesn't work. @RomanJahn have you managed to fix it? Thank you very much in advance. |
@entuto No unfortunately not. Waiting for any suggestions for myself ;-) |
Internally I don't see a reason why it won't work. Maybe you need to also notify Blazor of the change. In that case, just use |
In my code I already have StateHasChanged() right after Reset() but it doesn't work.
|
That was one of the first things I tried but did not change behavior. |
I have the same issue. Fundamentally the problem is that the input's sibling label element is not getting cleared. I came up with this fairly horrible hack to work around the issue. I created this JavaScript method: window.setFileInputLabel = (id, text) => {
var elem = document.getElementById(id);
if (elem) {
const parent = elem.parentElement;
const label = parent.querySelector('label');
if (label) {
label.textContent = text;
}
}
} To clear the label I call the method like so:
And finally in my FileEdit.Changed handler I set the label like so:
It's not the most elegant solution but it works. |
@gerfen thank you very much. It works! |
Thanks a lot. Works. |
I would like to remove the names of the files in the FileEdit component after uploading the files.
I tried Reset() manually as demonstrated in the docs but that doesn't work.
I also recognized that AutoReset is set to TRUE before I call Reset(), even though I set it to FALSE in the FileEdit-tag, as shown in the docs-example. Binding to a property also has no effect - it's always true. Only if I set AutoReset to false (from outside the component, which is not recommended), the AutoReset-bool stays false as expected.
My main question is: Is there a way of removing the file names manually?
Btw, I mainly used the example code.
Kind Regards
The text was updated successfully, but these errors were encountered: