spring-in-action-5-samples
spring-in-action-5-samples copied to clipboard
Chapter 2 - No save checkboxes state after validating
In addition to this: Chapter 2 validation problems #34
Instead of line
<input name="ingredients" type="checkbox" th:value="${ingred.id}"/>
should be
<input name="ingredients" type="checkbox" th:value="${ingred.id}" th:checked="${taco.ingredients != null} ? ${taco.ingredients.contains(ingred.id)}"/>
For me this works: DesignTacoController.java https://gist.github.com/olegkamuz/237a8e620159ce4010cee62ed81aad91 design.html https://gist.github.com/olegkamuz/a5c1dcf86c1592ce001e617a1b824fa1