Hello,
I am trying to set a th:field with a value from another model but I keep getting null. I found out that th:field
overrides th:value
and that Thymeleaf th:field
generates 3 html attributes id
, name
an value
so instead of th:field
, I should use th:id
, th:name
and th:value
. But why do I get null?
<input
th:id="*{roomType[__${rowStat.index}__].type}"
th:name="*{roomType[__${rowStat.index}__].type}"
th:value="${viewModel.getRooms()[__${rowStat.index}__].getType()}"
type="text"
hidden="hidden"/>