3

如何使用咆哮在一个弹出窗口中显示所有验证消息,因为默认情况下,客户端上的每条验证消息都会创建新的弹出窗口。

当然我可以在服务器端进行验证并将最终消息发送到咆哮但可以在客户端进行吗?

一些代码在这里:

<p:dialog id="chPwD" header="#{res['user.passwordDialogHeader']}" widgetVar="changePwV" closeOnEscape="true" resizable="false">
    <p:growl id="growl" showDetail="false" life="3000" />
    <h:panelGrid id="chPwPG" columns="1" cellpadding="1" transient="true">
        <h:panelGrid id="chPwPGi" columns="2" cellpadding="1">
            <p:outputLabel for="pwd0" value="#{res['user.oldPassword']}" />
            <h:panelGroup>
                <p:password id="pwd0" label="#{res['user.oldPassword']}" value="#{mngr.oldPassword}" required="true" style="width:250px;"/>
                <span style="display:inline-block;"><p:message for="pwd0"/><p:messages for="pwd0"/></span>
            </h:panelGroup>

            <p:outputLabel for="pwd1" value="#{res['user.newPassword']}" />
            <h:panelGroup>
                <p:password id="pwd1" label="#{res['user.newPassword']}" value="#{mngr.newPassword}" match="pwd2" required="true" style="width:250px;"/>
                <span style="display:inline-block;"><p:message for="pwd1"/></span>
            </h:panelGroup>

            <p:outputLabel for="pwd2" value="#{res['user.repeatNewPassword']}" />
            <h:panelGroup>
                <p:password id="pwd2" label="#{res['user.repeatNewPassword']}" value="#{mngr.newPassword}" required="true" style="width:250px;"/>
                <span style="display:inline-block;"><p:message for="pwd2"/></span>
            </h:panelGroup>
        </h:panelGrid>
    </h:panelGrid>
    <f:facet name="footer">
        <p:commandButton value="#{res['btn.apply']}" style="margin-right:20px;" update=":chPwPG" action="#{mngr.changeSelectedUserPassword}" oncomplete="handlePwChangeRequest(xhr, status, args)"/>
        <p:commandButton value="#{res['btn.cancel']}" onclick="changePwV.hide();" type="button"/>
    </f:facet>
</p:dialog>
4

1 回答 1

0

你应该试试<p:messages showDetail="false" showSummary="true"/>,它对我有用。

于 2013-12-09T08:05:40.737 回答