gpt4 book ai didi

forms - 仅在没有其他组件的消息时显示消息

转载 作者:行者123 更新时间:2023-12-02 03:47:39 24 4
gpt4 key购买 nike

我在验证表单时显示了 3 条消息,类似这样的:

<p:message id="msgCity1"  for="city1" styleClass="required" display="text" />
<p:message id="msgCity2" for="city2" styleClass="required" display="text" />
<p:message id="msgCountry" for="msgCountry" styleClass="required" display="text" />

第一条(msgCity1)和第二条(msgCity2)消息在事件(keyup)上进行验证最后一个是在服务器端验证,我想显示最后一条消息 (msgCountry),如果前 2 条消息的验证正常,我的意思是如果消息为空,

为此,我想在最后一条消息上使用渲染,但我不知道如何在 xhtml 中获取前 2 条消息的值

最佳答案

宁愿 Hook UIInput#isValid()直接而不是存在输入消息。

例如

<h:inputText id="city1" binding="#{city1}" ... />
<h:inputText id="city2" binding="#{city2}" ... />
...
<p:message for="msgCountry" ... rendered="#{city1.valid and city2.valid}" />

关于forms - 仅在没有其他组件的消息时显示消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15955756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com