title: PrimeFaces nested form inside p:dialog with appendTo="@(body)
body: <p>I have this fragment:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
  
      &lt;!-- other content --&gt;
  
      &lt;p:panel id="panel" header="test"&gt;
          &lt;p:inputText id="input1" value="#{viewScope.prop1}" required="true" /&gt;
          &lt;p:commandButton id="button1" process="@form" update="@form @widgetVar(dialog)"
              oncomplete="PF('dialog').show()" value="ok" /&gt;
      &lt;/p:panel&gt;
  
      &lt;!-- other content --&gt;
  
  &lt;/h:form&gt;
  
  &lt;p:dialog id="dialog" header="dialog" widgetVar="dialog" modal="true"&gt;
      &lt;h:form id="form2"&gt;
          &lt;p:inputText id="input2" value="#{viewScope.prop1}" required="true" /&gt;
          &lt;p:commandButton id="button2" process="@form" update="@form" value="ok" /&gt;
      &lt;/h:form&gt;
  &lt;/p:dialog&gt;
  </code></pre>
  
  <p>and all is working as expected.</p>
  
  <p>What I'd like to achieve is this:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
  
      &lt;!-- other content --&gt;
  
      &lt;!-- fragment start --&gt;
      &lt;!-- this fragment will be on its own file and included via ui:include (or inside composite component) --&gt;
      &lt;p:panel id="panel" header="test"&gt;
          &lt;p:inputText id="input1" value="#{viewScope.prop1}" required="true" /&gt;
          &lt;p:commandButton id="button1" process="@form" update="@form @widgetVar(dialog)"
              oncomplete="PF('dialog').show()" value="ok" /&gt;
      &lt;/p:panel&gt;
  
      &lt;p:dialog id="dialog" header="dialog" widgetVar="dialog" modal="true" appendTo="@(body)"&gt;
          &lt;h:form id="form2"&gt;
              &lt;p:inputText id="input2" value="#{viewScope.prop1}" required="true" /&gt;
              &lt;p:commandButton id="button2" process="@form" update="@form" value="ok" /&gt;
          &lt;/h:form&gt;
      &lt;/p:dialog&gt;
      &lt;!-- fragment end --&gt;
  
      &lt;!-- other content --&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>but I unsuccessfully tried some combination of <code>process</code> and <code>update</code> for <code>button1</code> resulting in process anything... <code>input1</code> is even resetting...</p>
  
  <p>So, how to build a <code>p:dialog</code> that can be shipped inside a fragment or a composite comp and that is excluded from outside <code>form</code>?</p>
  
  <p>Note that using:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
  
      &lt;!-- other content --&gt;
  
      &lt;ui:include src="panel.xhtml" /&gt;
  
      &lt;!-- other content --&gt;
  
  &lt;/h:form&gt;
  
  &lt;ui:include src="dialog.xhtml" /&gt;
  </code></pre>
  
  <p>is not an acceptable solution.</p>
  
  <p>I'm on JSF 2.2.8 (mojarra) and PF 5.1</p>