1 Reply Latest reply on Mar 5, 2014 4:25 AM by Tanja Schöberl

    RF 4.3.5.Final  a4j:commandbutton and oncomplete makes a full page reload

    Tanja Schöberl Newbie

      If I use an a4j:commandbutton with oncomplete the full page is reloaded.

       

      confirmationDialog.xhtml:

      <ui:composition>
         <a4j:region>
           <rich:popupPanel modal="true" id="confirmationPanel" minWidth="400" domElementAttachment="form">
                <f:facet name="header">
                     <h:panelGroup>
                          <h:outputText value="Best&#228;tigungsabfrage" />
                     </h:panelGroup>
                </f:facet>
                <f:facet name="controls">
                     <h:panelGrid>
                          <img src="icon_close.gif" onclick="#{rich:component('confirmationPanel')}.hide();" id="confirmationPanelImage" />
                     </h:panelGrid>
                </f:facet>
                      <p>Sind Sie sicher?</p>
                      <div align="center">
                          <a4j:commandButton action="#{personController.delete()}" id="yesConfirmationPanelButton" value="Ja" render="richTable"
                              oncomplete="#{rich:component('confirmationPanel')}.hide();"
                              onclick="#{rich:component('noConfirmationPanelButton')}.disabled=true; this.disabled=true;">
                          </a4j:commandButton>&#160;
                          <a4j:commandButton id="noConfirmationPanelButton" value="Nein"
                              onclick="#{rich:component('confirmationPanel')}.hide(); return false;" />
                      </div>
           </rich:popupPanel>
         </a4j:region>
      </ui:composition>
      
      
      
      

      The action:

      public void delete(){
           System.out.println("delete");
      }
      
      
      

       

      And the PopupPanel is called with an a4j:commandLink in a rich:DataTable (richTable):

      <a4j:commandLink render="confirmationDialog">
           <img src="/g_intranet-skin/images/desktop/icon_delete.gif" alt="entfernen" title="entfernen" />
           <rich:componentControl target="confirmationPanel" operation="show" />
      </a4j:commandLink>
      <ui:include src="confirmationDialog.xhtml"/>
      
      
      

       

      If I don't use the oncomplete and hide the Panel with the onclick, then the page is not reloaded.

       

      Can anybody help me?

      Regards Tanja

        • 1. Re: RF 4.3.5.Final  a4j:commandbutton and oncomplete makes a full page reload
          Tanja Schöberl Newbie

          I found the solution, but I don't understand it:

           

                       <a4j:commandButton action="#{actionParameter}" id="yesConfirmationPanelButton" value="Ja" render="#{updateComponent}"

                                  onclick="#{rich:element('noConfirmationPanelButton')}.disabled=true; this.disabled=true;">

                                  <a4j:ajax oncomplete="#{rich:component('confirmationPanel')}.hide();"></a4j:ajax>

                        </a4j:commandButton>

           

          I changed the onclick to "rich:element" and gave the oncomplete in an a4j:ajax...

          If the oncomplete is in the a4j:commandButton the panel is not hidden...

          1 of 1 people found this helpful