1 Reply Latest reply on Mar 21, 2013 4:38 PM by David Gibson

    rich:togglePanel navigation with commandButton problem

    Erdem YILMAZ Newbie

      Hi,

      We trying to create a wizard like page with rich:togglePanel, here is the wizard page:

       

       

      {code}

      <rich:togglePanel id="wizardPanel" activeItem="item1" render="tabs" switchType="ajax">

      <rich:togglePanelItem name="item1">

        <a4j:region id="outPanelRender1">

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

        </a4j:region>

      </rich:togglePanelItem>

      <rich:togglePanelItem name="item2">

        <a4j:region id="outPanelRender2">

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

        </a4j:region>

      </rich:togglePanelItem>

      <rich:togglePanelItem name="item3">

        <a4j:region id="outPanelRender3">

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

        </a4j:region>

      </rich:togglePanelItem>

      </rich:togglePanel>

      {code}

      in step2.xhtml we have 3 buttons that need to perform different actions like:

      {code}

                <rich:panel header="Comments">

       

                          <h:inputTextarea value="#{step5Bean.comment}" required="true"

                                    rows="15" cols="100">

                                    <f:validateLength maximum="1000" />

                          </h:inputTextarea>

                </rich:panel>

                <a4j:commandButton value="Back">

                          <rich:toggleControl targetItem="@prev" event="click" />

                </a4j:commandButton>

       

       

                <a4j:commandButton value="REJECT"

                          rendered="#{step5Bean.rejectVisible}"

                          actionListener="#{step5Bean.completeMyTask2}"

                          action="#{step5Bean.completeMyTaskReject()}">

                          <rich:toggleControl targetItem="@next" event="click" />

                </a4j:commandButton>

       

       

                <a4j:commandButton value="APPROVE"

                          rendered="#{step5Bean.approveVisible}"

                          actionListener="#{step5Bean.completeMyTask2}"

                          action="#{step5Bean.completeMyTaskApprove()}">

                          <rich:toggleControl targetItem="@next" event="click" />

                </a4j:commandButton>

      {code}

      Here is the Step5Bean.java in summary:

       

       

      {code}

      @Named

      @RequestScoped

      public class Step5Bean {

       

       

          private String comment;

          private boolean iadeVisible = false;

          private boolean redVisible = true;

          private boolean onaylaVisible = true;

       

       

                public void completeMyTask2() {

                          System.out.println("test listener");

          }

          public String completeMyTaskApprove() {

                          try {

                                    System.out.println("Approve");

                                    // some business logic here

                                    FacesUtil.addMessage(FacesMessage.SEVERITY_INFO, "Approved successfully.");

                          }

                          catch (Exception e) {

                                    FacesUtil.addMessage(FacesMessage.SEVERITY_ERROR, "Error in approval process.");

                          }

                          return "stepResult";

          }

                public String completeMyTaskReject() {

                          try {

                                    System.out.println("Reject");

                                    // some business logic here

                                    FacesUtil.addMessage(FacesMessage.SEVERITY_INFO, "Rejected successfully.");

                          }

                          catch (Exception e) {

                                    FacesUtil.addMessage(FacesMessage.SEVERITY_ERROR, "Error in reject process.");

                          }

                          return "stepResult";

          }

         

      {code}

       

       

      and the stepResult.xhtml page is:

      {code}

                <rich:panel header="─░┼člem Sonucu">

                          <rich:messages></rich:messages>

                </rich:panel>

      {code}

       

       

      When we click on the button Reject or Approve, only we see the stepResult.xhtml with empty message also the action and the actionListener of the both bottons do not work at all.

      is there a way to navigate other page with information that show the which botton is clicked?

       

       

      thanks a lot,

      Erdem