Replies: 1 comment · 1 reply
-
what about this? <select class="form-select input-widget" id="treat" tabindex="31" th:field="*{treat}">
<option value="">Please select...</option>
<option th:each="v : ${@baba.getTreat()}" th:data-key="${v.key}" th:text="${v.value}" th:value="${v.value}"></option>
</select> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In Thymeleaf I have this situation:
<select class="form-select input-widget" id="treat" tabindex="31" th:field="*{treat}"> <option value="">Please select...</option> <option th:each="v : ${@baba.getTreat()}" th:value="${v.key}" th:text="${v.value}"></option> </select>
and I have
String treat;
and i.e.
<option value="mynum">One</option
Now th:field maps the key (value attribute from option tag, in the example above "mynum") to the "treat" variable. But I want that the variable "treat" contains "One". How can I achieve this?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions