as I wrote the title, I'm having problems with using checkbox with Thymleaf.
My Form has a List of object "AssignFlag" with name "assignFlagList".
List<AssignFlagForm> assignFlagList;
object AssignFlagForm has 3 fields:
String codeValue;
String codeKey;
public boolean isChecked;
I want to create checkboxes for each AssignFlagForm, and post "true" value for each AssignFlag that is checked on the screen.
my thymleaf template goes:
<span th:each="assignFlag, stat : *{assignFlagList}">
<input type="checkbox" th:field="*{assignFlagList[__${stat.index}__].isChecked}"
th:value="*{'TRUE'}" style="margin-right: 0;" />
<label th:for="${'assignFlagList' + stat.index + '.isChecked1'}" th:text="${assignFlag.codeKey}" style="font-weight: normal;">
</label>
</span>
and I wrote this referring to the official document of Thymleaf https://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#checkbox-fields
but it doesn't work and I don't know why. Error code goes Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputCheckboxFieldTagProcessor' but I still can't figure out.
Could somebody please help me?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire