5 Replies Latest reply on Aug 14, 2007 5:45 PM by sergeysmirnov

    Conditional Action

      Does anyone have an example of how I might have the action of an link based on some other input value such as which radio button is selected at the time the link is pressed?


      <h:selectOneRadio value="#{fruitSelectionView.manufacturer}">
      <a4j:support event="onclick"
      reRender="dataTableReplacementParts,selectors" />
      <f:selectItems value="#{fruitSelectionView.allManufacturers}" />
      </h:selectOneRadio>


      <a4j:commandLink reRender="myPanel" action="BASED ON INPUT VALUE"
      id="cmdSubmit" >

        • 1. Re: Conditional Action

          just use the same action, but fork the behavior based on the #{fruitSelectionView.manufacturer} value there.

          • 2. Re: Conditional Action

            like so?

            <a4j:commandLink reRender="myPanel" action="#{fruitSelectionView.manufacturer}
            id="cmdSubmit" >

            • 3. Re: Conditional Action

              Of course, NO.

              Like:
              <a4j:commandLink reRender="myPanel" action="#{fruitSelectionView.gotoManufacturer}
              id="cmdSubmit" >

              • 4. Re: Conditional Action

                action="#{fruitSelectionView.gotoManufacturer}

                Well I wanted the action to be a navigation. Could this be done from the gotoManufacturer method. If so how.

                Sorry I am lost on this.

                Kevin

                • 5. Re: Conditional Action

                  Kevin, It sounds like we are not on the same page with you. From one side, it is hard for me to understand what is the problem to return different outcome from action method. From other side, you use ajax control (partial update) but want to navigate (full page refresh).

                  So, would you explain your usecase more clearly?