I want to present validation messages and messages from backing bean in <p:dialog>
component. In my JSF page I have following dialog defined:
<p:dialog widgetVar="messageDialog" id="msgDialog" modal="true" appendToBody="true">
<h:form id="messageForm">
<p:messages id="messagesInDialog" />
<p:commandButton value="OK" onclick="messageDialog.hide()" />
</h:form>
</p:dialog>
I execute the following code after appending some message in backing bean:
RequestContext.getCurrentInstance().execute("messageDialog.show()");
and it works fine.
However, I also want to display bean validation messages in this dialog. Messages are appended to <p:message>
component afer validation, but I have no idea how to display this dialog after validation failure.
How can I achieve this?