title: Update datatable from dialog
body: <p>I have datatable with button "add new". 
  Desired scenario is: </p>
  
  <ul>
  <li>Click on the button </li>
  <li>Fill in the form which is dispalyed in the dialog</li>
  <li>When validation fails show validation messages in the dialog When</li>
  <li>validation pass close the dialog, show success message and update<br>
  table</li>
  </ul>
  
  <p>With current setup 2 thing dont work</p>
  
  <ul>
  <li>Updating the datatable</li>
  <li>Validation messages are also displayed above the datatable, not onlu
  in the dialog (in the place for all messages - thats ok) but after
  successfull save, these messages stays there</li>
  </ul>
  
  <p>Messages displaying on top of the page</p>
  
  <pre><code>&lt;p:messages id="messages" autoUpdate="true" closable="true" escape="false"/&gt;
  </code></pre>
  
  <p>My XHTML:</p>
  
  <pre><code>&lt;h:form id="lookupTableForm"&gt;
          &lt;p:dataTable
                  id="lookupTable"
                  widgetVar="lookupTable"
                  var="lookup"
                  value="#{qlookupListBean.lookups}"
                  styleClass="listBlock"
                  lazy="true"
                  rows="20"
                  paginator="true"
                  paginatorAlwaysVisible="false"
                  sortBy="#{lookup.name}"
                  sortOrder="ascending"
                  rowsPerPageTemplate="20,100,500"&gt;
  
              &lt;f:facet name="header"&gt;#{msg['integrations.tabs.qlookup.title']}&lt;/f:facet&gt;
  
              &lt;p:column headerText="#{msg['qloookup.name']}"
                      sortBy="#{lookup.name}"&gt;
                  &lt;h:outputText value="#{lookup.name}" /&gt;
              &lt;/p:column&gt;
  
              &lt;p:column headerText="#{msg['qloookup.type.in']}"
                        sortBy="#{lookup.typeIn}"&gt;
                  &lt;h:outputText value="#{lookup.typeIn}" /&gt;
              &lt;/p:column&gt;
  
              &lt;p:column headerText="#{msg['qloookup.value.in']}"
                        sortBy="#{lookup.valueIn}"&gt;
                  &lt;h:outputText value="#{lookup.valueIn}" /&gt;
              &lt;/p:column&gt;
  
              &lt;p:column headerText="#{msg['qloookup.type.out']}"
                        sortBy="#{lookup.typeOut}"&gt;
                  &lt;h:outputText value="#{lookup.typeOut}" /&gt;
              &lt;/p:column&gt;
  
              &lt;p:column headerText="#{msg['qloookup.value.out']}"
                        sortBy="#{lookup.valueOut}"&gt;
                  &lt;h:outputText value="#{lookup.valueOut}" /&gt;
              &lt;/p:column&gt;
  
              &lt;f:facet name="footer"&gt;
                  &lt;div class="reset"&gt;&lt;/div&gt;
                  &lt;p:commandButton
                          onclick="newDialog.show()"
                          value="#{msg['qloookup.table.button.new']}"
                          styleClass="primaryButton" /&gt;
              &lt;/f:facet&gt;
  
          &lt;/p:dataTable&gt;
      &lt;/h:form&gt;
      &lt;p:dialog
              id="newDialog"
              header="#{msg['qloookup.new.title']}"
              closable="true"
              modal="true"
              position="top"
              resizable="false"
              width="430"
              height="400"
              onShow="finFwUI.setDialogPosition()"
              widgetVar="newDialog" styleClass="passwordDialog"&gt;
  
          &lt;h:form&gt;
              &lt;h:panelGrid columns="2" styleClass="w30"&gt;
                  &lt;p:outputLabel for="name"
                                 value="#{msg['qloookup.new.name']}" /&gt;
                  &lt;p:inputText id="name"
                          value="#{qlookupListBean.lookup.name}"
                          required="true"
                          styleClass="w30"&gt;
                      &lt;f:validateLength minimum="1" maximum="35" /&gt;
                  &lt;/p:inputText&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="name" display="text" /&gt;
                  &lt;p:outputLabel for="inType"
                                 value="#{msg['qloookup.type.in']}" /&gt;
                  &lt;p:selectOneMenu
                          id="inType"
                          value="#{qlookupListBean.lookup.typeIn}"
                          required="true"
                          filter="true"
                          filterMatchMode="contains"
                          styleClass="w30"&gt;
                      &lt;f:selectItems
                              value="#{qlookupListBean.qualifierTypes}"
                              var="type"
                              itemLabel="#{type.type}"
                              itemValue="#{type.type}" /&gt;
                      &lt;p:ajax event="change"
                              listener="#{qlookupListBean.reloadInValues}"
                              update="inValues" /&gt;
                  &lt;/p:selectOneMenu&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="inType" display="text" /&gt;
                  &lt;p:outputLabel for="inValues"
                                 value="#{msg['qloookup.type.in']}" /&gt;
                  &lt;p:selectOneMenu
                          id="inValues"
                          value="#{qlookupListBean.lookup.valueIn}"
                          required="true"
                          filter="#{qlookupListBean.inValues.size() gt 8}"
                          filterMatchMode="contains"
                          styleClass="w30"&gt;
                      &lt;f:selectItems
                              value="#{qlookupListBean.inValues}"
                              var="type"
                              itemLabel="#{type.value}"
                              itemValue="#{type.value}" /&gt;
                  &lt;/p:selectOneMenu&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="inValues" display="text" /&gt;
                  &lt;p:outputLabel for="key"
                                 value="#{msg['qloookup.key']}" /&gt;
                  &lt;p:inputText id="key"
                               value="#{qlookupListBean.lookup.key}"
                               required="true"
                               styleClass="w30"&gt;
                      &lt;f:validateLength minimum="1" maximum="35" /&gt;
                  &lt;/p:inputText&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="key" display="text" /&gt;
                  &lt;p:outputLabel for="outType"
                                 value="#{msg['qloookup.type.out']}" /&gt;
                  &lt;p:selectOneMenu
                          id="outType"
                          value="#{qlookupListBean.lookup.typeOut}"
                          required="true"
                          filter="true"
                          filterMatchMode="contains"
                          styleClass="w30"&gt;
                      &lt;f:selectItems
                              value="#{qlookupListBean.qualifierTypes}"
                              var="type"
                              itemLabel="#{type.type}"
                              itemValue="#{type.type}" /&gt;
                      &lt;p:ajax event="change"
                              listener="#{qlookupListBean.reloadOutValues}"
                              update="outValues" /&gt;
                  &lt;/p:selectOneMenu&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="outType" display="text" /&gt;
                  &lt;p:outputLabel for="outValues"
                                 value="#{msg['qloookup.value.out']}" /&gt;
                  &lt;p:selectOneMenu
                          id="outValues"
                          value="#{qlookupListBean.lookup.valueOut}"
                          required="true"
                          filter="#{qlookupListBean.outValues.size() gt 8}"
                          filterMatchMode="contains"
                          styleClass="w30"&gt;
                      &lt;f:selectItems
                              value="#{qlookupListBean.outValues}"
                              var="type"
                              itemLabel="#{type.value}"
                              itemValue="#{type.value}" /&gt;
                  &lt;/p:selectOneMenu&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="outValues" display="text" /&gt;
                  &lt;p:outputLabel for="value"
                                 value="#{msg['qloookup.value']}" /&gt;
                  &lt;p:inputText id="value"
                               value="#{qlookupListBean.lookup.value}"
                               required="true"
                               styleClass="w30"&gt;
                      &lt;f:validateLength minimum="1" maximum="70" /&gt;
                  &lt;/p:inputText&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="value" display="text" /&gt;
                  &lt;p:outputLabel for="description"
                                 value="#{msg['qloookup.description']}" /&gt;
                  &lt;p:inputTextarea id="description"
                                   value="#{qlookupListBean.lookup.description}"
                                   styleClass="w30"&gt;
                      &lt;f:validateLength maximum="255" /&gt;
                  &lt;/p:inputTextarea&gt;
                  &lt;h:outputText value="" /&gt;
                  &lt;p:message for="description" display="text" /&gt;
              &lt;/h:panelGrid&gt;
              &lt;div class="buttonsBlock"&gt;
                  &lt;p:commandButton
                          styleClass="primaryButton"
                          value="#{msg['button.save']}"
                          update="@form"
                          action="#{qlookupListBean.save}"
                          oncomplete="if (args &amp;amp;&amp;amp; !args.validationFailed) { newDialog.hide(); updateTable(); }" /&gt;&lt;!--    see http://stackoverflow.com/a/9195852/204950   --&gt;
                  &lt;p:commandButton
                          value="#{msg['button.cancel']}"
                          styleClass="buttonRight"
                          onclick="newDialog.hide();"
                          immediate="true" /&gt;
                  &lt;p:remoteCommand name="updateTable" update="@(lookupTableForm:lookupTable)" /&gt;
              &lt;/div&gt;
          &lt;/h:form&gt;
      &lt;/p:dialog&gt;
  </code></pre>
  
  <p>What should i change to get it work? Thanks.</p>
  
  <p><strong>EDIT</strong>
  Resolved the messages issue by modifying update on save command button</p>
  
  <pre><code>&lt;p:commandButton
                          styleClass="primaryButton"
                          value="#{msg['button.save']}"
                          update="@form, @(:messages)"
                          action="#{qlookupListBean.save}"
                          oncomplete="if (args &amp;amp;&amp;amp; !args.validationFailed) { newDialog.hide(); updateTable(); }" /&gt;
  </code></pre>
  
  <p><strong>EDIT 2</strong>
  I was wrong. Validation messages disapears with previous but now when i click save on empty form. Non ajax POST request is send on the server, page is reloaded and dialog is not shown.</p>