Also, putting a nested form inside p:dialog does not work. And yes, I do need the form outside p:dialog.
Nested forms seem to work correctly with plain JSF2 AJAX using h:commandButton and f:ajax, but I want to use PF AJAX as it gives me more control and JSF2 AJAX is not compatible with PF yet.
Here's a simple test case for the problem:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<f:view xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<html xmlns="http://www.w3.org/1999/xhtml">
<h:head>
<title>Test</title>
</h:head>
<h:body>
<h:outputLink value="javascript:void(0)" onclick="dlg.show()">Show</h:outputLink>
<h:form>
<p:dialog header="Name" widgetVar="dlg" resizable="false" width="500">
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="firstname" value="Name:" />
<h:inputText id="firstname" value="#{backingBean.name}" />
</h:panelGrid>
<p:commandButton value="Submit" update=":display" oncomplete="dlg.hide();"/>
</p:dialog>
</h:form>
<p:outputPanel id="display" style="display:block;margin-top:10px;">
<h:outputText id="name" value="#{backingBean.name}" />
</p:outputPanel>
</h:body>
</html>
</f:view>
As soon as h:form is inside p:dialog (and there is NO h:form outside the dialog -> no nested forms), the example starts to work.