2 Replies Latest reply on Jan 10, 2011 4:16 PM by ncarr

    Why my action located within a rich:modalPanel is not executed

    ncarr

      I try to implement a modal panel to let the user confirm the deletion of some entities without successful.


      Is here the code :


      1) the command I use to do some staff before entities deletion and to show the modal on completion :


      <h:form>
           <a4j:commandButton value="a4j:commandButton"  action="#{contractDeletor.prepareJob}"
                reRender="deleteContractsConfirmModalPanelId" ajaxSingle="true"
                          oncomplete="Richfaces.showModalPanel('deleteContractsConfirmModalPanelId',{width:400, top:200})" />                    
      </h:form>
      <a4j:include viewId="/ContractDeletionModal.xhtml" rendered="true" />



      1) the code of the modal (simplified for understanding) :



      <rich:modalPanel id="deleteContractsConfirmModalPanelId"
           autosized="true">
           <div id="deleteContractsConfirmModalPanelDivId">
           <form id="deleteContractsConfirmModalPanelForm">
                <a4j:commandButton value="a4j:commandButton"
                     action="#{contractDeletor.doJob}"
                     oncomplete="Richfaces.hideModalPanel('deleteContractsConfirmModalPanelId');"
                     reRender="deleteContractsConfirmModalPanelDivId" /></form>
           </div>
      </rich:modalPanel>



      When I click on the command a post back is performed whitout executing the action ??


      3) the related action (simplified):


      @Name("contractDeletor")
      public class ContractDeletor extends BaseListAnimator implements
                Serializable {
      
           private static final long serialVersionUID = -1465053605583307302L;
      
           public String prepareJob() {
                log.info("Prepare the job");
                
                return null;
           }
           
           public String doJob() {
                log.info("Do the job");
                
                return null;
           }
      } 




      I also tried to put the modal within the same page of the command that show it but it has the same effect.
      I probably miss something but I can figure it out.


      Many thanks in advance

        • 1. Re: Why my action located within a rich:modalPanel is not executed
          tmalatinszki

          Hi Nicolas,


          Did You try to use a4j:form instead form?


          <rich:modalPanel id="deleteContractsConfirmModalPanelId" autosized="true">
            <div id="deleteContractsConfirmModalPanelDivId">
              <a4j:form id="deleteContractsConfirmModalPanelForm">
                <a4j:commandButton value="a4j:commandButton" action="#{contractDeletor.doJob}"
                          oncomplete="Richfaces.hideModalPanel('deleteContractsConfirmModalPanelId');"
                          reRender="deleteContractsConfirmModalPanelDivId" />
              </a4j:form>
            </div>
          </rich:modalPanel>



          Regards,


          Tamas

          • 2. Re: Why my action located within a rich:modalPanel is not executed
            ncarr

            Hi Tamas,


            I did the trick.
            Actually your suggestion make me realized that I wrote <form>
            instead of <h:form>.
            It doesn't work with <form> but it does with <h:form> and also with <a4j:form>.


            Many thanks for your help.


            Nicolas