I allow the user to create some customized fields... therefore, I don't know their IDs. While showing such fields in the view, I need to use the value of one variable and use it to get the value of another variable. Currently, th:value="${udfield.id}" will of course only assign the value of "udfield.id". Is this possible?
<div data-th-each="udfield : ${udfields}">
<label th:text="${udfield.displayText}">User defined field:</label>
<input th:name="${udfield.id}" type="text" class="form-control" th:value="${udfield.id}"/>
</div>
My Controller sends the values which were extracted from a DB:
for (FieldValue currentFieldVal : userFieldValues){
attributes.addFlashAttribute(currentFieldVal.getFieldID(), currentFieldVal.getValue());
}
What I needed was preprocessing, I found it thanks to this question.
th:value="${__${udfield.id}__}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With