I am making web app using Java/Spring/Thymeleaf and don't seem to be able to get past this problem!
So, here's my thymeleaf template code:
<form th:action="@{/holiday/create}" th:object="${holiday}" method="post">
<select name="user_scroll">
<option th:each="user : ${allUsers}" th:value="${user.id}"
th:text="${user.email}" th:field="${holiday.user_id}" />
</select>
<button type="submit">
Create
</button>
</form>
I have read the related questions on here but am still stumped. I did read that you can't bind an object directly that's why I am trying to bind to the user_id property of the holiday object. I did suspect the holiday object my be out of scope but that doesn't seem to be the case. Perhaps I am accessing the user_id property incorrectly?
When I click submit and follow debug through to my controller user_id is just sent through as null. I hope that's enough info - let me know if I need to provide more. Thanks!