首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SelectManyCheckbox组件中的所需消息

SelectManyCheckbox组件中的所需消息
EN

Stack Overflow用户
提问于 2012-03-14 00:05:26
回答 1查看 2.8K关注 0票数 0

我在RichFaces 4中使用JSF2.1,我有一个带有selectManyCheckbox的表单,我希望它在处理表单之前至少选择一个项。

我将属性required变为true,但如果单击submit按钮而不选择至少一个复选框,则不会出现任何消息。

我怎么能这么做?

干杯

更新

代码语言:javascript
复制
                <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}"/>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-03-14 20:18:54

您需要为该<h:message>附加一个<h:selectManyCheckbox>

代码语言:javascript
复制
<h:selectManyCheckbox id="dependencies" ...>
    ...
</h:selectManyCheckbox>
<h:message for="dependencies" />

验证消息将显示在那里。

在使用ajax提交表单时,请确保ajax呈现/更新中也包含了<h:message>组件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9694093

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档