Accessing Html-Tag Values (innerHTML,value)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Accessing Html-Tag Values (innerHTML,value)

Hello everyone,

sorry for the inconvenience if a similiar question like this has already been asked. Unfortunately I'm not finding an answer to my question elsewhere.

I'm looking for a pure HTML/Thymeleaf solution without Javascript, etc.
I am trying to access the HTML-Values(.innerHTML,.value,.files.length) with thymeleaf and for example set the th:max value according to a files.length-Value of a different tag.

I have a Form with File Input and a Progress Bar.
Now I want the th:max Attribute of Progress Bar to scale accordingly to the number of files, selected by the user.

<form th:object="${dataObject}" method="post" enctype="multipart/form-data" action="/savedata">
<input id="fileChooser" type="file" multiple />
<progress th:value="0" th:max="???" ></progress>

<!-- In Javascript you would say something like this to get the number of selected files by the user: -->

I'm also thinking about dynamically updating the th:value tag of <progress>. I'm almost sure there is no way to do this exclusively with HTML/Thymleaf and completely without Javascript or a similiar scripting language, but I'm ready to change my mind, if there is a nice solution to that.

Big Thanks in Advance
Yours sincerly