Primefaces clientValidator消息未显示 [英] Primefaces clientValidator message not displayed
本文介绍了Primefaces clientValidator消息未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用Primefaces
I tried to use Primefaces
<p:clientValidator>
以及
<p:message>
,但没有成功.该消息根本不显示.这是我的.xhtml的代码段:
but without any success. The message is simply not displayed. Here is a snippet of my .xhtml:
<h:form id="systemLogTable">
...
<h:panelGroup>
<p:inputText id="last-input" value="#{lazyLogsDataModel.lastTime}" size="10" disabled="#{lazyLogsDataModel.timeFilteringOption != 2}">
<p:ajax event="keyup" update="logsTable" />
<p:clientValidator event="keyup" update="msg"/>
</p:inputText>
<h:selectOneMenu id="selectLastType" value="#{lazyLogsDataModel.lastUnit}" disabled="#{lazyLogsDataModel.timeFilteringOption != 2}">
<f:selectItem itemLabel="Days" itemValue="0"/>
<f:selectItem itemLabel="Hours" itemValue="1" />
<f:selectItem itemLabel="Minutes" itemValue="2" />
<a4j:ajax event="change" render="systemLogTable" />
</h:selectOneMenu>
</h:panelGroup>
<p:message id="msg" for="last-input"/>
...
</h:form>
有人可以告诉我我做错了什么吗? 我也尝试过
Can anybody tell me what I'm doing wrong? I also tried with
<p:messages autoUpdate="true" />
代替
<p:message for="last-input" />
可以,但是我更喜欢专用消息而不是全局消息.
and it worked but I prefer a dedicated message instead of global messages.
推荐答案
PrimeFaces客户端验证默认情况下处于禁用状态,并且需要添加以下全局参数才能启用它:
PrimeFaces client-side validation is disabled by default and adding the following global parameter is required to enable it:
<context-param>
<param-name>primefaces.CLIENT_SIDE_VALIDATION</param-name>
<param-value>true</param-value>
</context-param>
这篇关于Primefaces clientValidator消息未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文