Checkboxes are a special kind of field, since they often come in groups, sharing the same name but having different values. The TMT Validator validates a set of checkboxes with the same name as a unique entity. So, inside a set of checkboxes, we can define the validation attributes only once (if you specify attributes with conflicting values, the last one wins):
<input type="checkbox" name="drink" tmt:minchecked="2" value="Nicole" />
<input type="checkbox" name="drink" value="Kate" />
There are two different attributes for checkboxes validation.
The tmt:minchecked ensures that at least a minimum number of boxes are checked in a group:
<input type="checkbox" name="drink" tmt:minchecked="2" value="Nicole" />
The tmt:maxchecked specifies a maximum number of boxes that can be checked in a group:
<input type="checkbox" name="drink" tmt:maxchecked="3" value="Nicole" />
We can use both attributes at the same time:
<input type="checkbox" name="drink" tmt:minchecked="2" tmt:maxchecked="3" value="Nicole" />
If we want only one box checked, set both attributes to 1:
<input type="checkbox" name="pasta" tmt:minchecked="1" tmt:maxchecked="1" value="Penne" />