3
    <p:dialog widgetVar="dlgEdit" header="Add New Status">
        <h:form id="editFrm">
            <h:panelGrid columns="3" id="pnlEdit">
                <p:outputLabel value="Status"/>
                <p:inputText id="txtStatus" required="true"/>
                    <p:message for="txtStatus" />
           </h:panelGrid>
    </p:dialog>

这是一个不在对话框中呈现的 primefaces 消息标签。并且对话框隐藏在 onComplete 事件中..

        How can I RENDER validation message in DIALOG using jsf?

感谢您的任何建议!

4

2 回答 2

5

在您的提交按钮中添加这些条目

ajax="true" update=":#{p:component('message')}" oncomplete="if(!args.validationFailed)dlgEdit.hide();"

这将在同一个对话框中打印您的消息。

于 2013-04-24T21:32:42.840 回答
0

Is it ok if your validation message is displayed in the parent page?

If yes, in that case you can throw a feedback error message. This will be picked up by the p:message in your parent page.

If no, please refer to this question below in this link for dialog window with ajax=false situation.

于 2013-07-24T00:46:23.563 回答