3 Replies Latest reply on Nov 6, 2008 5:47 AM by choesang tenzin

    Problem with modalPanel wizard

    Pedro Ribeiro Newbie

      Hi! I've started studying RichFaces a couple of weeks ago, so I'm not really good at it yet. I was hoping if some of you could help me with this question.

      I'm trying to build a wizard, like in the examples, but using modelPanel. This wizard has three different pages, and is called from inside a dataTable, used to edit user's accounts.

      The first time I run it is everything nice, but on the second time, the modelpanel shows the last page. And I expected that it would show the first, in order to start over the process of editing an account.

      I searched some solutions for this problem here, but I found it difficult to understand and I couldn't reproduce it here (maybe couse I'm a newbie =/). I would really be thankful if someone could help me.

      Here is a piece of my code:

      - modelPanel call

      <a4j:commandLink action="#{accountController.setAccountRow}" id="delete" oncomplete="javascript:Richfaces.showModalPanel('deletepanel')" reRender="deleteForm">
       <h:graphicImage id="imagedel"
       url="images/broadcast_option_delete.gif">
       </h:graphicImage>
      </a4j:commandLink>
      


      - modelPanel code

      <rich:modalPanel id="editpanel" height="546" width="450" headerClass="title" style="border: 1; border-color:#888888">
       <f:facet name="header">
       <h:panelGroup styleClass="title">
       <h:graphicImage value="images/window_title_create_user.gif" styleClass="img"/>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup styleClass="close">
       <h:graphicImage value="images/window_button_close.gif" styleClass="close" id="hideedit" />
       <rich:componentControl for="editpanel" attachTo="hideedit" operation="hide" event="onclick" />
       </h:panelGroup>
       </f:facet>
       <div>
       <h:form id="editForm">
       <a4j:include viewId="/edit_acc_data.jsp"/>
       </h:form>
       </div>
       </rich:modalPanel>
      


      Please, tell me if i didn't make myself clear. Thank you all =]

      Pedro.


        • 1. Re: Problem with modalPanel wizard
          choesang tenzin Newbie

          I am facing exactly the same problem. It would be great, if somebody could give a hint on where the mistake could be.

          cheers!
          Chö

          • 2. Re: Problem with modalPanel wizard
            Nick Belaevski Master

            Hello,

            Try to

            1. Bind viewId to model bean property:

            <a4j:include viewId="#{bean.property}"/>


            2. Reset bean.property to initial value by command link action activation.

            • 3. Re: Problem with modalPanel wizard
              choesang tenzin Newbie

              Hi Nick, Thanks alot for your help. It worked beautifully. I am posting my code here for those who are interested.

              index.xhtml

              <h:outputLink value="#" onclick="Richfaces.showModalPanel('mpWizard');">showWizard</h:outputLink>
              
              <rich:modalPanel id="mpWizard" width="600" height="300" zindex="2000"
               resizeable="false" moveable="true">
               <f:facet name="header">Titel des Popups</f:facet>
               <f:facet name="controls">
               <h:graphicImage value="/images/close.png"
               style="cursor:pointer"
               onclick="Richfaces.hideModalPanel('mpWizard')" />
               </f:facet>
               <h:panelGroup id="wizardPanelGroup">
               <a4j:include viewId="#{wizardBean.viewId}" />
               </h:panelGroup>
               </rich:modalPanel>
              


              step1.xhtml

              
              <h:form>
              
               <h:outputText value="Go to the step 2"/>
               <a4j:commandButton value="next" action="gonext" reRender="wizardPanelGroup"/>
               </h:form>
              


              step2.xhtml

              
              <h:form>
              
               <h:outputText value="Close window"/>
              
               <h:commandButton type="button" value="Close" onclick="Richfaces.hideModalPanel('mpWizard')"/>
              
               </h:form>
              


              WizardBean.java


              public class WizardBean {
              
               private String viewId="/wizard/step1.xhtml";
              
               /**
               * @return the viewId
               */
               public String getViewId() {
               return viewId;
               }
              
               /**
               * @param viewId the viewId to set
               */
               public void setViewId(String viewId) {
               this.viewId = viewId;
               }
              
              
              }
              


              faces-config.xml

              <managed-bean>
               <managed-bean-name>wizardBean</managed-bean-name>
               <managed-bean-class>bean.WizardBean</managed-bean-class>
               <managed-bean-scope>request</managed-bean-scope>
               </managed-bean>
               <navigation-rule>
               <from-view-id>/wizard/step1.xhtml</from-view-id>
               <navigation-case>
               <from-outcome>gonext</from-outcome>
               <to-view-id>/wizard/step2.xhtml</to-view-id>
               </navigation-case>
               </navigation-rule>