我刚刚升级到JSF 2.3和Wildfly 14(从2.0和13)和primefaces 6.2.5。
当我使用命令按钮时,我注意到一种奇怪的行为。我有2种形式,当按下第一种形式的按钮时,第二种形式的输入将被验证,并且错误(在这种情况下是必需的错误)显示在p:message中:
<h:form id="form1" prependId="false">
<p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="@form">
<f:actionListener binding="#{myBean.reloadResults()}" />
</p:commandButton>
<p:messages id="msgs" severity="error,warn" escape="false">
<p:autoUpdate />
</p:messages>
...
</h:form>
<p:dialog >
<h:form id="form2" >
<p:messages severity="error,warn" escape="false">
<p:autoUpdate />
</p:messages>
<div>
<p:calendar id="myDate" value="#{myBean.myDate}" required="true" />
</div>
...
</h:form>
</p:dialog>
我希望只处理和验证第一个表格的内容。 Wildfly 13和jsf 2.0就是这种情况。
有什么主意吗?
答案 0 :(得分:0)
您尚未在命令按钮中指定属性过程。默认值为@all,它将验证所有表单。 请使用process =“ @ form”以避免其他形式的验证和处理。
更新的代码如下:
<p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="@form" process="@form">
<f:actionListener binding="#{myBean.reloadResults()}" />
</p:commandButton>
答案 1 :(得分:0)
对于未发布完整代码,我深表歉意,但这可能太大了。我发现了问题所在。与此错误有关:
https://github.com/primefaces/primefaces/issues/4122
我有一个4列的panelgrid,但其中有10个元素。
然后整个ajax通讯中断了。修复程序即将出现在PF 6.3
中