i have som dialogs with input fields, for example a name or similar. These fields are marked as required. So if i submit the dialog and close it via oncomplete the error message which is within the dialog is not displayed. I'm looking for a solution that the dialog not closes when a validation error happens. How can i do it?
Here is an example code:
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Facelet Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<p:resources/>
</h:head>
<h:body>
Hello from Facelets
<h3>Events</h3>
<h:form prependId="false">
<p:commandLink id="submit" oncomplete="dialog.show();" >
<h:outputText value="Open dialog"/>
</p:commandLink>
</h:form>
<h:form prependId="false">
<p:dialog header="Testdialog" widgetVar="dialog" fixedCenter="true" modal="true" draggable="false"
effect="fade" effectDuration="0.3" id="testDialog">
<h:panelGrid id="testGrid" columns="2" >
<h:outputText value="Enter value:" />
<h:inputText id="value" value="#{pprBean.firstname}" required="true"/>
<f:facet name="footer">
<h:panelGroup>
<p:commandButton action="#{pprBean.doSomething}" id="action" value="Submit" oncomplete="dialog.hide();"/>
</h:panelGroup>
</f:facet>
</h:panelGrid>
<p:messages/>
</p:dialog>
</h:form>
</h:body>
</html>