【发布时间】:2012-10-24 15:19:22
【问题描述】:
我试图在用户每次单击单选按钮时显示验证消息。
这仅在我点击提交按钮时有效,但在我点击单选按钮时无效:
<h:form id="form">
<p:panel id="panel">
<ui:repeat value="#{questionsBean}" var="question">
<h:panelGrid columns="3" style="margin-bottom:10px" cellpadding="5">
<h:outputText value="#{question.questionText}" />
<p:selectOneRadio id="question" value="#{question.response}"
validator="#{question.validate}" required="true">
<f:selectItem itemLabel="Yes" itemValue="Yes" />
<f:selectItem itemLabel="No" itemValue="No" />
<p:ajax update="msgQuestion" event="change"/>
</p:selectOneRadio>
<p:message for="question" id="msgQuestion" />
</h:panelGrid>
</ui:repeat>
<p:commandButton id="btn" value="Save" update="panel" partialSubmit="true"/>
</p:panel>
</h:form>
【问题讨论】:
-
这似乎与 ui:repeat...在没有 ui:repeat 的情况下工作正常。
标签: jsf jsf-2 primefaces selectoneradio