2

How to change label from input type=file?

I want to change "Dateien auswählen" and "keine ausgewählt" with Thymeleaf tag with international (Ressourcen bundle).

This is my code:

    <input th:classappend="${#fields.hasErrors('fileList')}? 'is-invalid'"
    class="form-control"
    type="file"
    th:text="#{com.mddoc.file.select}"
    th:field="*{fileList}" multiple/>

And the result:

enter image description here

andrewJames
  • 19,570
  • 8
  • 19
  • 51
mkemal
  • 21
  • 1
  • I am not even sure why is this question so up-voted. This has nothing to do with Thymeleaf. Answer on the question: can you change this input label with setting the attribute `text`? No, period. How Thymeleaf would make it different? What you need to do is the find the solution to change the label first (there are so many of them: with JS, CSS and regular `label` HTML tag) try it and after do Thymeleaf templating when satisfied with static HTML result. For example: [Change default text in input type=“file”?](https://stackoverflow.com/questions/5138719/change-default-text-in-input-type-file) – Slava Ivanov Jul 19 '21 at 18:01

0 Answers0