I’m using JSF 2.1 with RichFaces 4 and I have a form with a selectManyCheckbox which I want it to have at least one item selected before processing the form.
I put to true the attribute required but no message appears when I click the submit button without selecting at least one checkbox.
How can I do that?
Cheers
UPDATE
<a4j:outputPanel id="cargaDependencias">
<h:selectManyCheckbox layout="pageDirection" required="true"
requiredMessage="Seleccione al menos una dependencia"
disabled="#{administrationBean.loadAllDependencies}"
value="#{administrationBean.selectedDependencies}">
<f:selectItems value="#{administrationBean.loadSelectDependencies}"/>
</h:selectManyCheckbox>
</a4j:outputPanel>
<br/><br/>
<a4j:commandButton value="Actualizar Cubo"
action="#{administrationBean.doUpdateInformationCube}"/>
You need to attach a
<h:message>for the<h:selectManyCheckbox>.The validation message will show in there.
When using ajax to submit the form, make sure that the
<h:message>component(s) are also included in the ajax render/update.