我在RichFaces 4中使用JSF2.1,我有一个带有selectManyCheckbox的表单,我希望它在处理表单之前至少选择一个项。
我将属性required变为true,但如果单击submit按钮而不选择至少一个复选框,则不会出现任何消息。
我怎么能这么做?
干杯
更新
<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}"/>发布于 2012-03-14 20:18:54
您需要为该<h:message>附加一个<h:selectManyCheckbox>。
<h:selectManyCheckbox id="dependencies" ...>
...
</h:selectManyCheckbox>
<h:message for="dependencies" />验证消息将显示在那里。
在使用ajax提交表单时,请确保ajax呈现/更新中也包含了<h:message>组件。
https://stackoverflow.com/questions/9694093
复制相似问题