11 Replies Latest reply on Oct 9, 2012 3:56 PM by kauedg

    <h:commandButton> doesn't work in <rich:popupPanel>

    kanal

      Hi,

      there is a problem with popupPanel component.

      I have in it both <h:commandButton> and <h:commandLink> which do the same thing.

      But the commandLink works and commandButton does not.

       

      Here is an exmaple code how it looks:

      <rich:popupPanel id="popupDel" height="120">
         <div>
             <h:commandLink action="#{someBean.delete(element)}" value="delete" />
              
             <h:commandLink onclick="#{rich:component('popupDel')}.hide()" value="cancel" />
             <br />
             <h:commandButton action="#{someBean.delete(element)}" value="delete" />
              
             <h:commandButton value="cancel">
                 <rich:componentControl target="popupDel" operation="hide" />
             </h:commandButton>
         </div>
      </rich:popupPanel>
      

       

      Of course the popupPanel is placed in a form.

      Maybe there is some reason that commandButton doesn't work.

      If anyone know, please tell me.

        • 1. Re: <h:commandButton> doesn't work in <rich:popupPanel>
          sivaprasad9394

          <h:panelGroup>
          <h:graphicImage value="../_assets/image/close.png" id="hidelinkEditBlacklisting"
          styleClass="hidelink" />
          <rich:componentControl for="editBlacklistingModal" attachTo="hidelinkEditBlacklisting"
          operation="hide" event="onclick" />
          </h:panelGroup>

          try like this,

           

          <h:commandButton value="cancel" id="hidelinkcancel" />

          <rich:componentControl for="popupDel" attachTo="hidelinkcancel"

          operation="hide" event="onclick" />

           

          • 2. Re: <h:commandButton> doesn't work in <rich:popupPanel>
            kanal

            Thank you for your reply.

            Sorry but I wasn't precise enough.

             

            The problem is with the commandButton that accomplish an action (deletes an element passed through method parameter).

            The one which hides popupPanel works. So the action of commandButton is not processed.

            • 3. Re: <h:commandButton> doesn't work in <rich:popupPanel>
              amarkhel

              Hi, Paul. There are normal behavior for popupPanel, in 3.3.3 modalPanel works same. To solve your problem you can:

              1. Use a4j:commandButton(workAround)

              2. Use domElementAttachment="form" for popupPanel(it is proper way). I just try with domElementAttachment="form" and find small bug, but I fixed and commited solution. So in next build this problem will be gone.

              • 4. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                kanal

                Hi Andrey,

                I used a4j:commandPanel instead and it also does not work.

                 

                <rich:popupPanel id="popupDel">
                   ...
                   <a4j:commandButton action="#{rolesMB.deleteRole(role)}" value="elo" />
                   ...
                </rich:popupPanel>
                

                 

                It seems that there is a problem with executing beans methods in buttons (both h: and a4j:).

                • 5. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                  amarkhel

                  Hi, Paul. You must use

                   

                  <rich:popupPanel domElementAttachment="form" id="popupDel">
                     ...
                     <h:commandButton action="#{rolesMB.deleteRole(role)}" value="elo" />
                     ...
                  </rich:popupPanel>

                  I am manually tested this sample, and all works fine

                  • 6. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                    kanal

                    I have just tried it and after this change the popup does not show. Moreover, some kind of script is running and then firefox message comes up that the script is busy or it may stopped responding (and i have options to continue execute script or to stop it). So this domElementAttachment attribute is not the solution ;/

                    • 7. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                      amarkhel

                      Paul, I am wrote you earlier, that were a bug with no-end loop in javascript:) I fixed it at Thursday, so in next build this fix will be included. Did you try last snapshots?

                      • 8. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                        kanal

                        I have just tried the richfaces-showcase-4.0.0-20101001.173900-63 snapchot. The popupPanel causes errors in firefox and it breaks down.

                        Moreover, this latest snapshot is quite bugged. ExtendedDataTable looks terrible ;| I will hove to go back to richfaces-showcase-4.0.0-20100920.160629-50 one.

                         

                        I think that i'll just have to wait until a4j:commandButton will be rapaired in popupPanel.

                        • 9. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                          dcarpio

                          Hi everyone.

                           

                          This time the problem is with the a4j:commandButton component. It needs to be clicked twice to work properly despite I have checked several times the code and it looks fine for me. What this button only does is redirect to another page.

                           

                          The code looks like this:

                           

                          <rich:popupPanel id="popup" modal="true" resizeable="true" domElementAttachment="form">
                          ...
                          <h:form>
                               <h:outputText value="Home" />     
                               <a4j:commandButton value="Click me" actionListener="#{myBean.saveAction}" />
                          </h:form>
                          ...
                          </rich:popupPanel>
                          

                           

                          And the code of method listener is:

                           

                          public void saveAction(ActionEvent event) throws IOException {
                               ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
                               externalContext.redirect(externalContext.getRequestContextPath() + "/pages/anotherPage.jsf");
                          }
                          

                           

                          I'm using Richfaces 4.0.1-SNAPSHOT. Can anyone help me? Thanks for your replies.

                          • 10. Re: <h:commandButton> doesn't work in <rich:popupPanel>

                            Is this problem solved? I have the same problem. I tried a4j:commandButton, a4j:commandLink, h:commandButton... all require click-twice to fire action. I cannot make it twice because it should close the popup in "oncomplete=......"!

                             

                            I cannot use domElementAttachment=parent/form because my popup has its own form inside, and it should submit its own data only.

                             

                            I have latest RF 4.2.2 on Glassfish 3.1.1.

                             

                            This worked well in RF 3.3.3.

                            • 11. Re: <h:commandButton> doesn't work in <rich:popupPanel>
                              kauedg

                              This worked for me...

                               

                               

                              <rich:popupPanel id="popup" modal="true" autosized="true" resizeable="false" domElementAttachment="form">

                              ...

                              <ui:include src="Edit.xhtml"/>

                              <a4j:commandButton value="Save changes" actionListener="#{testController.update()}" />

                              ...

                              </rich:popupPanel>