我对 Richfaces 客户端验证有疑问。这是我的 xhtml 页面示例;
<h:form id="deneForm">
<rich:panel>
<h:panelGrid columns="2">
<h:inputText value="#{denemeBean.name}" id="name" required="true" requiredMessage="Not null please">
<f:validateLength minimum="3" maximum="8" />
<f:validateRequired />
<rich:validator />
</h:inputText>
<rich:message for="name" />
<h:outputText value="Email" />
<h:outputText value="Age" />
<h:inputText value="#{denemeBean.age}" id="age" required="true" requiredMessage="Not null please">
<f:validateLongRange minimum="18" maximum="99"/>
<rich:validator />
</h:inputText>
<rich:message for="age" />
</h:panelGrid>
<h:commandButton value="Submit" action="#{denemeBean.success}"> </h:commandButton>
</rich:panel>
</h:form>
当我将值写入文本框时,我可以看到验证错误,但是当我按下提交按钮时,客户端脚本未激活并且无论如何都提交了表单。服务器端验证开始并显示“请不要为空”。如何在按下提交按钮时触发客户端验证?
使用:mojarra 2,richfaces 4