title: PrimeFaces Dialog + appendToBody=true not working
body: <p>I'm using PF 3.5 and JSF Mojarra 2.1.</p>
  
  <p>I have a dialog which I want to use appendToBody=true. This usually results in "unpredictable behavior" though.</p>
  
  <p>Basically what the dialog does is, when I choose an entry (a persn entity) from a datatable, it gives me filled up input boxes which I can edit, thus editing the particular entry (person details).</p>
  
  <p>Sometimes the input boxes get filled up properly with the entries data. Sometimes they dont.
  This behavior does not happen with appendToBody=false.
  Aside from that I'm pretty sure there are no nested forms.</p>
  
  <p>As you will notice I am trying out a "One page design" with purely ajax navigation.</p>
  
  <p>Main page (index.xhtml)</p>
  
  <pre><code>&lt;h:body&gt;
  
      &lt;pe:layout id="page" fullPage="true"&gt;
  
          &lt;!-- North --&gt;
          &lt;pe:layoutPane id="north" position="north" minSize="140"
              closable="true" resizable="false"&gt;
              ....
          &lt;/pe:layoutPane&gt;
  
          &lt;!-- West --&gt;
          &lt;pe:layoutPane id="west" position="west" minWidth="150" size="180"
              style="font-size: 14px !important;" closable="true"
              styleClassHeader="menuBar" resizable="false"&gt;
              &lt;f:facet name="header"&gt;Main Menu&lt;/f:facet&gt;
  
              &lt;h:form id="form1"&gt;
  
                  &lt;p:panelMenu id="panelMenu" style="width: 160px !important"&gt;
  
                      &lt;!-- On menu click update with Ajax centerpanel and msgPanel --&gt;
                      &lt;p:submenu label="Persons" style="font-size: 10px "&gt;
  
                          &lt;p:menuitem value="Person List" update=":centerpanel"
                              actionListener="#{layout.setAll('formPersonList.xhtml', 'Person List')}"
                              action="#{person.init()}"&gt;
                          &lt;/p:menuitem&gt;
  
                      &lt;/p:submenu&gt;
  
                      .....
  
                  &lt;/p:panelMenu&gt;
              &lt;/h:form&gt;
          &lt;/pe:layoutPane&gt;
  
          &lt;!-- Center --&gt;
          &lt;pe:layoutPane id="content" position="center"
              style="font-size: 14px !important" styleClassHeader="menuBar"&gt;
  
              &lt;h:panelGroup id="centerpanel" layout="block"&gt;
                  &lt;ui:include id="include" src="#{layout.navigation}" /&gt;
  
              &lt;/h:panelGroup&gt;
  
          &lt;/pe:layoutPane&gt;
      &lt;/pe:layout&gt;
  </code></pre>
  
  <p>The dialog is in a file formPersonList.xhtml and is outside the form</p>
  
  <pre><code>&lt;ui:composition ....&gt; 
  
        &lt;h:form id="mainForm"&gt;
              &lt;p:contextMenu for="personTable"&gt;
  
                  &lt;p:menuitem value="View Details" 
                              process="@form" actionListener="#{person.handleSelectedPerson()}"
                              update=":dlgPersonGrp"
                              oncomplete="dlgPerson.show();"&gt;
                  &lt;/p:menuitem&gt;
  
              &lt;/p:contextMenu&gt;
  
          &lt;p:dataTable id="personTable ....&gt;
              ....person entities
          &lt;/p:dataTable&gt;
  
        &lt;/h:form&gt;
  
      &lt;p:dialog   widgetVar="dlgPerson" showEffect="size"
                  width="1100"  appendToBody="true"&gt;
  
                  &lt;h:panelGroup id="dlgPersonGrp"&gt;
                      &lt;ui:include src="formPerson.xhtml" /&gt;
                  &lt;/h:panelGroup&gt;
  
       &lt;/p:dialog&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>Finally, the form with the input boxes: formPerson.xhtml</p>
  
  <pre><code>&lt;ui:composition ....&gt; 
  
        &lt;h:form id ="subForm"&gt;
                  ....Input boxes that are supposed to be filled up from a backing bean 
                      and then resubmitted to edit the chosen entry
  
  
        &lt;/h:form&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>I have tried to dumb it down as much as possible. Let me know if you need more detail.</p>