For some reason Seam Framework doesn’t include form validation to ensure at least one checkbox is selected out of a group of checkboxes. Like a radio button, but more than one may be selected. One custom code sample was dodgy because validation takes place in JSF lifecycle before the model is updated, so you must wait for the component tree to be built before such a validation can take place.

You may use jQuery validation but what if the user has JavaScript disabled in their web browser? Or the JS payload hasn’t yet arrived? You still require backend assertion for the correct entity state.

The solution I found wasn’t optimal but hey, I’m not the only one wanting this simple form functionality.

Define a custom <mytaglib:atLeastOneValidator> tag

/resources/WEB-INF/web.xml

/resources/WEB-INF/compositions.taglib.xml

Create AtLeastOneValidator validator specific for that tag

/src/main/validator/AtLeastOneValidator.java

Test out <mytaglib:atLeastOneValidator>

/view/atLeastOneValidatorTest.xhtml