Click here to Skip to main content
15,891,717 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am trying to set a th:field with a value from another model but I keep getting 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"/>


What I have tried:

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?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900